-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from marko-js/modernize
feat: add support for jest 27 BREAKING CHANGE: drop support for using @marko/jest as a preset which was deprecated (use @marko/preset/browser or @marko/preset/node) BREAKING CHANGE: drop support node 12
- Loading branch information
Showing
32 changed files
with
7,623 additions
and
5,421 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.vscode | ||
node_modules | ||
coverage | ||
dist | ||
__snapshots__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{ | ||
"root": true, | ||
"extends": ["eslint:recommended", "prettier"], | ||
"parserOptions": { | ||
"sourceType": "module", | ||
"impliedStrict": true | ||
}, | ||
"env": { | ||
"jest": true, | ||
"node": true, | ||
"es2020": true, | ||
"browser": true | ||
}, | ||
"overrides": [ | ||
{ | ||
"files": ["**/*.ts"], | ||
"parser": "@typescript-eslint/parser", | ||
"extends": [ | ||
"eslint:recommended", | ||
"plugin:@typescript-eslint/recommended", | ||
"prettier" | ||
], | ||
"rules": { | ||
"@typescript-eslint/explicit-module-boundary-types": "off", | ||
"@typescript-eslint/no-non-null-assertion": "off", | ||
"@typescript-eslint/no-empty-function": "off", | ||
"@typescript-eslint/no-explicit-any": "off" | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"quiet": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: CI | ||
|
||
on: | ||
pull_request: | ||
paths-ignore: ["**.md"] | ||
push: | ||
branches: ["main"] | ||
paths-ignore: ["**.md"] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node: [14.x, 16.x] | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Use node@${{ matrix.node }} | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: ${{ matrix.node }} | ||
- name: Install dependencies | ||
run: npm ci | ||
- name: Lint code | ||
run: npm run lint | ||
- name: Run tests | ||
run: npm run ci:test | ||
- name: Report code coverage | ||
run: npm run ci:report |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,12 +10,9 @@ | |
npm-debug.log | ||
|
||
# Build | ||
/transform | ||
/preset | ||
dist | ||
*.tsbuildinfo | ||
|
||
# Coverage | ||
coverage | ||
.nyc_output | ||
|
||
# Test | ||
*.actual.* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
_ |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"*.ts": ["eslint -f codeframe --fix", "prettier --write"], | ||
"*{.js,.json,.md,.yml,rc}": ["prettier --write"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,8 @@ | ||
.vscode | ||
.nyc_output | ||
package.json | ||
package-lock.json | ||
CHANGELOG.md | ||
node_modules | ||
coverage | ||
/preset | ||
/transform | ||
*.actual.* | ||
dist | ||
__snapshots__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"overrides": [ | ||
{ | ||
"files": "*rc", | ||
"options": { | ||
"parser": "json" | ||
} | ||
} | ||
] | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
const fs = require("fs"); | ||
const glob = require("tiny-glob"); | ||
const { build } = require("esbuild"); | ||
|
||
(async () => { | ||
await fs.promises.rmdir("dist", { recursive: true }).catch(() => {}); | ||
|
||
// Ideally we'd use the same bundling / codesplitting as esm for cjs, | ||
// but thats not yet possible with esbuild, so we manually build each file. | ||
// https://github.com/evanw/esbuild/issues/1341 | ||
await build({ | ||
format: "cjs", | ||
outdir: "dist", | ||
platform: "node", | ||
target: ["node14"], | ||
entryPoints: await glob("src/{preset,transform}/**/*.ts"), | ||
}); | ||
})().catch((err) => { | ||
if (!err.errors) { | ||
console.error(err); | ||
} | ||
|
||
process.exit(1); | ||
}); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,21 @@ | ||
const base = { | ||
const common = { | ||
transform: { | ||
"\\.ts$": "ts-jest", | ||
"\\.css$": "jest-transform-css" | ||
} | ||
"\\.ts$": "esbuild-jest", | ||
"\\.css$": "jest-transform-css", | ||
}, | ||
}; | ||
|
||
module.exports = { | ||
projects: [ | ||
{ | ||
...base, | ||
preset: "./preset/node/jest-preset.js", | ||
displayName: "node", | ||
testEnvironment: "node", | ||
testMatch: ["<rootDir>/test/server.test.ts"] | ||
...common, | ||
preset: "./src/preset/node/jest-preset.ts", | ||
testMatch: ["<rootDir>/test/server.test.ts"], | ||
}, | ||
{ | ||
...base, | ||
preset: "./preset/browser/jest-preset.js", | ||
displayName: "browser", | ||
testMatch: ["<rootDir>/test/browser.test.ts"] | ||
} | ||
] | ||
...common, | ||
preset: "./src/preset/browser/jest-preset.ts", | ||
testMatch: ["<rootDir>/test/browser.test.ts"], | ||
}, | ||
], | ||
}; |
Oops, something went wrong.