mirror of
https://github.com/Kong/insomnia.git
synced 2026-11-04 20:13:48 -05:00
fix(insomnia-test): use import.meta.dirname instead of __dirname in ESM specs
insomnia-test is "type": "module", so __dirname is undefined and `playwright test --list` collected 0 tests, failing the Shard Matrix job. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
19775e16f0
commit
91e81950c5
9 files changed
+13
-13
No files matched your search
+2
-2
@@ -9,8 +9,8 @@ import { ProjectType } from "../../../../../enums/project-types";
|
||||
import { test } from "../../../../../misc/fixtures";
|
||||
import { Project } from "../../../../../models/project";
|
||||
|
||||
const wsdl = fs.readFileSync(path.join(__dirname, "calculator.wsdl"), "utf8");
|
||||
const soapBody = fs.readFileSync(path.join(__dirname, "soap-body.xml"), "utf8");
|
||||
const wsdl = fs.readFileSync(path.join(import.meta.dirname, "calculator.wsdl"), "utf8");
|
||||
const soapBody = fs.readFileSync(path.join(import.meta.dirname, "soap-body.xml"), "utf8");
|
||||
|
||||
test("Import WSDL by Clipboard", async ({ user }) => {
|
||||
const { httpRequestFlow, importFlow, workspaceFlow } = user.flowManager;
|
||||
|
||||
@@ -17,7 +17,7 @@ import { Project } from "../../../../models/project";
|
||||
const url = `${HTTP_SERVER}/post`;
|
||||
const title = faker.string.alphanumeric(8);
|
||||
const fixtureFilePath = path.join(
|
||||
__dirname,
|
||||
import.meta.dirname,
|
||||
"..",
|
||||
"..",
|
||||
"..",
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@ test("Import Generates Content-Type Header From Postman File", async ({
|
||||
);
|
||||
|
||||
const filePath = path.join(
|
||||
__dirname,
|
||||
import.meta.dirname,
|
||||
"import-content-type-from-postman.json",
|
||||
);
|
||||
await importFlow.importFile(project, filePath);
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ test("Import Multiple Workspaces From Single File", async ({ user }) => {
|
||||
new Project(faker.string.alphanumeric(10), ProjectType.Local),
|
||||
);
|
||||
|
||||
const filePath = path.join(__dirname, "multiple-workspaces.yaml");
|
||||
const filePath = path.join(import.meta.dirname, "multiple-workspaces.yaml");
|
||||
await importFlow.importFile(project, filePath);
|
||||
|
||||
const collection1 = await workspaceFlow.getCollection("Collection 1");
|
||||
|
||||
+2
-2
@@ -15,7 +15,7 @@ test("Import OpenAPI Spec by File", async ({ user }) => {
|
||||
new Project(faker.string.alphanumeric(10), ProjectType.Local),
|
||||
);
|
||||
|
||||
const filePath = path.join(__dirname, "httpbingo-get.json");
|
||||
const filePath = path.join(import.meta.dirname, "httpbingo-get.json");
|
||||
await importFlow.importFile(project, filePath);
|
||||
|
||||
const nodes = await workspacePage.getNodes();
|
||||
@@ -30,7 +30,7 @@ test("Import OpenAPI Spec by YAML File", async ({ user }) => {
|
||||
new Project(faker.string.alphanumeric(10), ProjectType.Local),
|
||||
);
|
||||
|
||||
const filePath = path.join(__dirname, "httpbingo-get.yaml");
|
||||
const filePath = path.join(import.meta.dirname, "httpbingo-get.yaml");
|
||||
await importFlow.importFile(project, filePath);
|
||||
|
||||
const nodes = await workspacePage.getNodes();
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ import { expect } from "@playwright/test";
|
||||
|
||||
import { test } from "../../../misc/fixtures";
|
||||
|
||||
const LEGACY_DB_DIR = path.join(__dirname, "insomnia-legacy-db");
|
||||
const LEGACY_DB_DIR = path.join(import.meta.dirname, "insomnia-legacy-db");
|
||||
|
||||
const testWithLegacyDatabase = test.extend({
|
||||
dataPath: async ({ dataPath }, use) => {
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ import { expect } from "@playwright/test";
|
||||
|
||||
import { test } from "../../../misc/fixtures";
|
||||
|
||||
const LEGACY_DB_DIR = path.join(__dirname, "insomnia-legacy-db");
|
||||
const LEGACY_DB_DIR = path.join(import.meta.dirname, "insomnia-legacy-db");
|
||||
|
||||
const testWithLegacyDatabase = test.extend({
|
||||
dataPath: async ({ dataPath }, use) => {
|
||||
|
||||
+2
-2
@@ -20,8 +20,8 @@ test(
|
||||
const dataPath = await appFlow.getDataPath();
|
||||
const pluginDir = path.join(dataPath, 'plugins', `insomnia-plugin-test`);
|
||||
fs.mkdirSync(pluginDir, { recursive: true });
|
||||
fs.copyFileSync(path.join(__dirname, 'plugin-package.json'), path.join(pluginDir, 'package.json'));
|
||||
fs.copyFileSync(path.join(__dirname, 'plugin-main.js'), path.join(pluginDir, 'main.js'));
|
||||
fs.copyFileSync(path.join(import.meta.dirname, 'plugin-package.json'), path.join(pluginDir, 'package.json'));
|
||||
fs.copyFileSync(path.join(import.meta.dirname, 'plugin-main.js'), path.join(pluginDir, 'main.js'));
|
||||
await preferencesPluginsPage.reloadPlugins();
|
||||
|
||||
const project = await workspaceFlow.createProject(new Project(faker.string.alphanumeric(10), ProjectType.Local));
|
||||
|
||||
+2
-2
@@ -22,8 +22,8 @@ test(
|
||||
const dataPath = await appFlow.getDataPath();
|
||||
const pluginDir = path.join(dataPath, 'plugins', `insomnia-plugin-test`);
|
||||
fs.mkdirSync(pluginDir, { recursive: true });
|
||||
fs.copyFileSync(path.join(__dirname, 'plugin-package.json'), path.join(pluginDir, 'package.json'));
|
||||
fs.copyFileSync(path.join(__dirname, 'plugin-main.js'), path.join(pluginDir, 'main.js'));
|
||||
fs.copyFileSync(path.join(import.meta.dirname, 'plugin-package.json'), path.join(pluginDir, 'package.json'));
|
||||
fs.copyFileSync(path.join(import.meta.dirname, 'plugin-main.js'), path.join(pluginDir, 'main.js'));
|
||||
await preferencesPluginsPage.reloadPlugins();
|
||||
|
||||
const project = await workspaceFlow.createProject(new Project(faker.string.alphanumeric(10), ProjectType.Local));
|
||||
|
||||
Reference in new issue
Block a user