This repository has been archived by the owner on Dec 12, 2024. It is now read-only.
generated from TBD54566975/tbd-project-template
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Align ts tests with production bundle (#138)
- Loading branch information
1 parent
ee2994a
commit 9d50a69
Showing
15 changed files
with
112 additions
and
29 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
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
2 changes: 1 addition & 1 deletion
2
bound/typescript/.mocharc.json → bound/typescript/.mocharc.cjs.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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"enable-source-maps": true, | ||
"exit": true, | ||
"spec": ["tests/compiled/node/**/*.test.js"] | ||
"spec": ["tests/compiled/cjs/**/*.test.js"] | ||
} |
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 @@ | ||
{ | ||
"enable-source-maps": true, | ||
"exit": true, | ||
"spec": ["tests/compiled/esm/**/*.test.js"] | ||
} |
14 changes: 1 addition & 13 deletions
14
bound/typescript/bundle-browser.js → bound/typescript/bundle-browser-cjs.js
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,15 @@ | ||
import esbuild from "esbuild"; | ||
|
||
esbuild.build({ | ||
entryPoints : ["./src/index.ts"], | ||
bundle : true, | ||
format : "esm", | ||
sourcemap : true, | ||
minify : true, | ||
platform : "browser", | ||
target : ["chrome101", "firefox108", "safari16"], | ||
define : { | ||
"global": "globalThis", | ||
}, | ||
outfile: "dist/browser.mjs", | ||
}); |
File renamed without changes.
File renamed without changes.
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 @@ | ||
import { fileURLToPath } from 'node:url' | ||
|
||
import esbuild from 'esbuild' | ||
import path from 'node:path' | ||
import fs from 'node:fs' | ||
|
||
const __filename = fileURLToPath(import.meta.url); | ||
const __dirname = path.dirname(__filename); | ||
|
||
fs.copyFileSync(`${__dirname}/../src/wasm/generated.d.ts`, `${__dirname}/compiled/bound/typescript/src/wasm/generated.d.ts`) | ||
fs.copyFileSync(`${__dirname}/../src/wasm/generated.js`, `${__dirname}/compiled/bound/typescript/src/wasm/generated.js`) | ||
|
||
esbuild.buildSync({ | ||
entryPoints: [`${__dirname}/compiled/bound/typescript/tests/**/*.test.js`], | ||
format : 'cjs', | ||
bundle : true, | ||
sourcemap : true, | ||
platform : 'browser', | ||
target : ['chrome101', 'firefox108', 'safari16'], | ||
outdir : `${__dirname}/compiled/browser/cjs`, | ||
define : { | ||
'global': 'globalThis', | ||
}, | ||
}); |
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,20 @@ | ||
import { fileURLToPath } from 'node:url' | ||
import esbuild from 'esbuild' | ||
import path from 'node:path' | ||
import fs from 'node:fs' | ||
|
||
const __filename = fileURLToPath(import.meta.url); | ||
const __dirname = path.dirname(__filename); | ||
|
||
fs.copyFileSync(`${__dirname}/../src/wasm/generated.d.ts`, `${__dirname}/compiled/bound/typescript/src/wasm/generated.d.ts`) | ||
fs.copyFileSync(`${__dirname}/../src/wasm/generated.js`, `${__dirname}/compiled/bound/typescript/src/wasm/generated.js`) | ||
|
||
esbuild.buildSync({ | ||
entryPoints: [`${__dirname}/compiled/bound/typescript/tests/**/*.test.js`], | ||
format: 'cjs', | ||
bundle: true, | ||
sourcemap: true, | ||
platform: 'node', | ||
target: ['node18'], | ||
outdir: `${__dirname}/compiled/cjs`, | ||
}); |
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,27 @@ | ||
import { playwrightLauncher } from '@web/test-runner-playwright' | ||
|
||
/** | ||
* @type {import('@web/test-runner').TestRunnerConfig} | ||
*/ | ||
export default { | ||
files : ['./tests/compiled/browser/esm/**/*.test.js'], | ||
playwright : true, | ||
browsers : [ | ||
playwrightLauncher({ | ||
product: 'chromium', | ||
}), | ||
playwrightLauncher({ | ||
product: 'firefox', | ||
}), | ||
playwrightLauncher({ | ||
product: 'webkit', | ||
}), | ||
], | ||
testsFinishTimeout : 300000, | ||
concurrentBrowsers : 1, | ||
testFramework : { | ||
config: { | ||
timeout: '30000', | ||
}, | ||
} | ||
}; |