Skip to content

Commit f350da5

Browse files
committed
test: convert the test runner to mjs
1 parent 3047280 commit f350da5

File tree

2 files changed

+17
-14
lines changed

2 files changed

+17
-14
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"dev": "run-p lib:watch lib:test:watch",
1919
"serve": "serve dist -p 8080",
2020
"test": "run-s build test:lib test:quickstart",
21-
"test:lib": "node ./test/test-runner.js",
21+
"test:lib": "node ./test/test-runner.mjs",
2222
"test:quickstart": "(cd examples/quickstart && npm install && npm run test)",
2323
"lint": "prettier --write **/*.js **/*.ts **/*.json !build/**/* !dist/**/*",
2424
"lint:ci": "prettier --check **/*.js **/*.ts **/*.json !build/**/* !dist/**/*",

test/test-runner.js renamed to test/test-runner.mjs

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
1-
const { promisify } = require("util");
2-
const fs = require("fs/promises");
3-
const { dirname, join } = require("path");
4-
5-
const Express = require("express");
6-
const Mocha = require("mocha");
7-
const glob = promisify(require("glob"));
8-
const pptr = require("puppeteer");
9-
10-
const asc = require("assemblyscript/cli/asc");
11-
12-
globalThis.AsBind = require("../dist/as-bind.cjs.js");
1+
import { promisify } from "util";
2+
import fs from "fs/promises";
3+
import { dirname, join } from "path";
4+
import { createRequire } from "module";
5+
6+
import Express from "express";
7+
import Mocha from "mocha";
8+
import globOrig from "glob";
9+
import pptr from "puppeteer";
10+
import asc from "assemblyscript/cli/asc";
11+
import AsBind from "../dist/as-bind.cjs.js";
12+
13+
const require = createRequire(import.meta.url);
14+
const glob = promisify(globOrig);
15+
globalThis.AsBind = AsBind;
1316

1417
async function main() {
15-
process.chdir(__dirname);
18+
process.chdir("./test");
1619
await asc.ready;
1720

1821
await compileAllAsc();

0 commit comments

Comments
 (0)