-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
97 additions
and
1 deletion.
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,17 @@ | ||
const { pullConfigs } = require('pull-configs') | ||
|
||
const local = __dirname + '/' | ||
const remote = 'https://github.com/stagas/typescript-minimal-template/raw/main/' | ||
|
||
const { assign, omit, sort, merge, replace } = pullConfigs(remote, local) | ||
|
||
merge('package.json', (prev, next) => { | ||
assign(prev.scripts, omit(next.scripts, ['build:min', 'test'])) | ||
sort(assign(prev.devDependencies, next.devDependencies)) | ||
}) | ||
replace('.eslintrc.js') | ||
replace('.prettierrc') | ||
replace('jest.config.js') | ||
replace('tsconfig.json') | ||
replace('web-test-runner.config.js') | ||
merge('.vscode/settings.json') |
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,42 @@ | ||
module.exports = { | ||
testEnvironment: 'jsdom', // or node | ||
rootDir: '.', | ||
roots: ['<rootDir>/test/', '<rootDir>/src'], | ||
testMatch: ['**/*.spec.{js,jsx,ts,tsx}'], | ||
testPathIgnorePatterns: ['<rootDir>/node_modules/', '<rootDir>/test/web/'], | ||
coverageDirectory: '<rootDir>/coverage', | ||
collectCoverageFrom: ['src/**/*.{ts,tsx}'], | ||
coverageProvider: 'v8', | ||
|
||
// enable this for real typescript builds (slow but accurate) | ||
// preset: 'ts-jest', | ||
|
||
// enable this for fast, correct sourcemaps but not all features supported | ||
transform: { | ||
'\\.(js|jsx|ts|tsx)$': [ | ||
'@stagas/sucrase-jest-plugin', | ||
{ | ||
jsxPragma: 'h', | ||
jsxFragmentPragma: 'Fragment', | ||
production: true, | ||
disableESTransforms: true, | ||
}, | ||
], | ||
}, | ||
|
||
// enable this for fast, incorrect sourcemaps but more features supported | ||
|
||
// transform: { | ||
// '\\.(js|jsx|ts|tsx)$': [ | ||
// '@swc-node/jest', | ||
// { | ||
// experimentalDecorators: true, | ||
// emitDecoratorMetadata: true, | ||
// react: { | ||
// pragma: 'h', | ||
// pragmaFrag: 'Fragment', | ||
// }, | ||
// }, | ||
// ], | ||
// }, | ||
} |
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,35 @@ | ||
const { esbuildPlugin } = require('@web/dev-server-esbuild') | ||
const { summaryReporter } = require('@web/test-runner') | ||
const { fromRollup } = require('@web/dev-server-rollup') | ||
const rollupCommonjs = require('@rollup/plugin-commonjs') | ||
|
||
const commonjs = fromRollup(rollupCommonjs); | ||
|
||
module.exports = { | ||
concurrency: 1, | ||
nodeResolve: true, | ||
files: ['test/**/*.spec.web.{ts,tsx}'], | ||
plugins: [ | ||
esbuildPlugin({ | ||
ts: true, | ||
tsx: true, | ||
jsxFactory: 'h', | ||
jsxFragment: 'Fragment', | ||
}), | ||
commonjs(), | ||
], | ||
reporters: [ | ||
summaryReporter(), | ||
], | ||
coverageConfig: { | ||
include: ['src/**/*.{ts,tsx}'], | ||
}, | ||
testRunnerHtml: testFramework => ` | ||
<html> | ||
<head> | ||
<script type="module" src="${testFramework}"></script> | ||
<script type="module">import 'jest-browser-globals';</script> | ||
</head> | ||
</html> | ||
`, | ||
} |