Skip to content

Commit

Permalink
Make unit tests ES modules
Browse files Browse the repository at this point in the history
  • Loading branch information
andy128k committed Dec 21, 2023
1 parent 3bd8436 commit 5ca8330
Show file tree
Hide file tree
Showing 44 changed files with 551 additions and 622 deletions.
1,148 changes: 536 additions & 612 deletions package-lock.json

Large diffs are not rendered by default.

16 changes: 11 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"pretest": "npm run lint && npm run fmt-check",
"test-import": "node ./test-packages/test-mjs/index.js",
"test-require": "node ./test-packages/test-cjs/index.js",
"test": "jest",
"test": "export NODE_OPTIONS=--experimental-vm-modules || set NODE_OPTIONS=--experimental-vm-modules&& jest",
"test-all": "npm test && npm run test-import && npm run test-require",
"clean": "rimraf dist/",
"prebuild": "npm run clean",
Expand Down Expand Up @@ -65,21 +65,27 @@
"@typescript-eslint/eslint-plugin": "^6.2.0",
"@typescript-eslint/parser": "^6.2.0",
"eslint": "^8.26.0",
"eslint-config-prettier": "^8.5.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-jest": "^27.1.3",
"eslint-plugin-prettier": "^5.0.0",
"icojs": "^0.17.0",
"icojs": "^0.19.3",
"jest": "^29.2.1",
"jest-image-snapshot": "^6.1.0",
"prettier": "^3.0.0",
"rimraf": "^5.0.1",
"typescript": "^5.0.4",
"unbuild": "^1.1.2"
"unbuild": "^2.0.0"
},
"jest": {
"testTimeout": 180000,
"testMatch": [
"<rootDir>/test/**/*.test.mjs"
],
"extensionsToTreatAsEsm": [
".ts"
],
"setupFilesAfterEnv": [
"<rootDir>/test/setup.js"
"<rootDir>/test/setup.mjs"
],
"collectCoverage": true,
"collectCoverageFrom": [
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion test/setup.js → test/setup.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ async function imagePlanes(image) {
return [image];
}

const planes = await ICO.parse(image.contents, "image/png");
const planes = await ICO.parseICO(image.contents, "image/png");
const result = [];

for (const plane of planes) {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
7 changes: 3 additions & 4 deletions test/util.js → test/util.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import * as path from "path";

function fixture(uri) {
return path.resolve(__dirname, "fixtures", uri);
function fixture(name) {
const url = new URL(`fixtures/${name}`, import.meta.url);
return url.pathname;
}

export const logo_png = fixture("logo.png");
Expand Down

0 comments on commit 5ca8330

Please sign in to comment.