Skip to content

Commit

Permalink
Tell the Tests how to handle VM_LOCAL_DEV
Browse files Browse the repository at this point in the history
  • Loading branch information
NullVoxPopuli committed Sep 9, 2024
1 parent 56f82bb commit 11be7c4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@
"build": "dotenv -- turbo build",
"build:control": "rollup -c rollup.config.mjs",
"build:flags": "RETAIN_FLAGS=true ember build --env production --suppress-sizes",
"link:all": "esyes ./bin/link-all.mts",
"clean": "node ./bin/clean.mjs",
"link:all": "esyes ./bin/link-all.mts",
"lint": "npm-run-all lint:*",
"lint:files": "turbo lint",
"lint:format": "prettier -c .",
"lint:types": "tsc -b",
"lintfix": "pnpm turbo test:lint -- --fix && prettier -w .",
"start": "ember serve --port=7357",
"start": "vite",
"test": "node bin/run-tests.mjs",
"test:babel-plugins": "yarn workspace @glimmer/vm-babel-plugins test",
"test:browserstack": "ember test --test-port=7774 --host 127.0.0.1 --config-file=testem-browserstack.js",
Expand Down
17 changes: 16 additions & 1 deletion vite.config.mts
Original file line number Diff line number Diff line change
@@ -1,10 +1,25 @@
import { defineConfig } from 'vite';
import { PluginOption, defineConfig } from 'vite';

export default defineConfig({
server: {
open: '?hidepassed',
},
mode: 'testing',
plugins: [
/**
* A similar plugin exists for our rollup builds
*/
{
name: 'define custom import.meta.env',
async transform(code) {
if (code.includes('import.meta.env.VM_LOCAL_DEV')) {
return code.replace(/import.meta.env.VM_LOCAL_DEV/g, 'true');
}
return undefined;
},
enforce: 'pre',
},
],
resolve: {
extensions: ['.mjs', '.js', '.mts', '.ts', '.jsx', '.tsx', '.json', '.d.ts'],
},
Expand Down

0 comments on commit 11be7c4

Please sign in to comment.