Skip to content

Commit

Permalink
test: fix ci (#10586)
Browse files Browse the repository at this point in the history
* test: fix ci

* chore: fix test
  • Loading branch information
sorrycc authored Feb 23, 2023
1 parent c7a6b86 commit 0be5d13
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions examples/test-test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"private": true,
"scripts": {
"dev": "umi dev",
"setup": "umi setup",
"start": "npm run dev",
"test": "jest --no-cache --coverage"
},
Expand Down
1 change: 1 addition & 0 deletions packages/preset-umi/src/features/tmpFiles/routes.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ test('getRoutes', async () => {
},
],
},
userConfig: {},
applyPlugins(opts: any) {
return opts?.initialValue;
},
Expand Down
7 changes: 6 additions & 1 deletion packages/preset-umi/src/features/tmpFiles/tmpFiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,12 @@ export default function EmptyRoute() {
'...$1',
);
// import: route props
headerImports.push(`import routeProps from './routeProps.js';`);
// why has this branch? since test env don't build routeProps.js
if (process.env.NODE_ENV === 'test') {
headerImports.push(`import routeProps from './routeProps';`);
} else {
headerImports.push(`import routeProps from './routeProps.js';`);
}
// prevent override internal route props
headerImports.push(`
if (process.env.NODE_ENV === 'development') {
Expand Down

0 comments on commit 0be5d13

Please sign in to comment.