Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.

Commit 1e0fd4b

Browse files
committed
test: test built module in CI
1 parent a8d7d75 commit 1e0fd4b

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ jobs:
5858

5959
- name: Test project
6060
run: yarn test:${{ matrix.test }}
61+
with:
62+
TEST_BUILT_MODULE: true
6163

6264
unit:
6365
strategy:

test/fixture/nuxt.config.ts

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { join, resolve } from 'upath'
22
import type { NuxtConfig } from '@nuxt/types'
3-
import compositionAPIModule from '../../src/module'
43

54
const routes = ['/route/a', '/static/1', '/static/2', '/static/3']
65
const interval = 3000
@@ -10,10 +9,21 @@ const isTesting = process.env.NODE_ENV !== 'development'
109

1110
const rootDir = resolve(__dirname, '../..')
1211

12+
const inDevelopment = !process.env.TEST_BUILT_MODULE
13+
14+
console.log('Testing', inDevelopment ? 'source' : 'built', 'module')
15+
1316
export default <NuxtConfig>{
1417
alias: {
15-
'@nuxtjs/composition-api/dist/globals': join(rootDir, 'src/globals'),
16-
'@nuxtjs/composition-api': join(rootDir, 'src'),
18+
'@nuxtjs/composition-api/dist/globals': join(
19+
rootDir,
20+
inDevelopment ? 'src' : 'dist',
21+
'globals'
22+
),
23+
'@nuxtjs/composition-api': join(
24+
rootDir,
25+
inDevelopment ? 'src/index.ts' : 'dist/index.js'
26+
),
1727
},
1828
target: isGenerated ? 'static' : 'server',
1929
publicRuntimeConfig: {
@@ -58,7 +68,10 @@ export default <NuxtConfig>{
5868
routes,
5969
interval,
6070
},
61-
buildModules: ['@nuxt/typescript-build', compositionAPIModule as any],
71+
buildModules: [
72+
'@nuxt/typescript-build',
73+
join(rootDir, inDevelopment ? 'src' : 'dist', 'module'),
74+
],
6275
pwa: {
6376
icon: false,
6477
manifest: false,

0 commit comments

Comments
 (0)