Skip to content

Commit

Permalink
separate test cases
Browse files Browse the repository at this point in the history
- add cjs test cases
- add esm test cases, filter them for now
  • Loading branch information
vankop authored and stefanprobst committed Mar 20, 2023
1 parent 8d20f38 commit 97887ab
Show file tree
Hide file tree
Showing 16 changed files with 25 additions and 10 deletions.
@@ -1,17 +1,10 @@
it("should pass package.json type to loader", function (done) {
it("should pass package.json type to loader", function () {
expect(require("cjs/loader.js!")).toBe("commonjs");
expect(require("esm/loader.js!")).toBe("module");
expect(require("./loader.js!")).toBe("undefined");
});

it("should pass 'commonjs' type to loader for .cjs", function () {
expect(require("cjs/loader.cjs!")).toBe("commonjs");
expect(require("esm/loader.cjs!")).toBe("commonjs");
expect(require("./loader.cjs!")).toBe("commonjs");
});

it("should pass 'module' type to loader for .mjs", function () {
expect(require("cjs/loader.mjs!")).toBe("module");
expect(require("esm/loader.mjs!")).toBe("module");
expect(require("./loader.mjs!")).toBe("module");
expect(require("esm/loader.cjs!")).toBe("commonjs");
});
File renamed without changes.
File renamed without changes.
9 changes: 9 additions & 0 deletions test/cases/loaders/esm-loader-type/index.js
@@ -0,0 +1,9 @@
it("should pass package.json type to loader", function () {
expect(require("esm/loader.js!")).toBe("module");
});

it("should pass 'module' type to loader for .mjs", function () {
expect(require("cjs/loader.mjs!")).toBe("module");
expect(require("esm/loader.mjs!")).toBe("module");
expect(require("./loader.mjs!")).toBe("module");
});
File renamed without changes.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions test/cases/loaders/esm-loader-type/test.filter.js
@@ -0,0 +1,5 @@
module.exports = function(config) {
// TODO need fix in v8 https://github.com/nodejs/node/issues/35889
// TODO otherwise this test case cause segment fault
return false;
};

0 comments on commit 97887ab

Please sign in to comment.