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 0d2622c
Show file tree
Hide file tree
Showing 44 changed files with 577 additions and 625 deletions.
1,176 changes: 560 additions & 616 deletions package-lock.json

Large diffs are not rendered by default.

17 changes: 12 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": "cross-env 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 @@ -64,22 +64,29 @@
"@types/xml2js": "^0.4.11",
"@typescript-eslint/eslint-plugin": "^6.2.0",
"@typescript-eslint/parser": "^6.2.0",
"cross-env": "^7.0.3",
"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: 4 additions & 3 deletions test/util.js → test/util.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import * as path from "path";
import { fileURLToPath } from "node:url";

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

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

0 comments on commit 0d2622c

Please sign in to comment.