Skip to content

Commit 08de8bc

Browse files
add tests to pipeline
1 parent f09d7e5 commit 08de8bc

File tree

5 files changed

+50
-13
lines changed

5 files changed

+50
-13
lines changed

.github/workflows/test-copytask.yml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Copy Task Tests
2+
3+
on:
4+
workflow_call:
5+
# Make this a reusable workflow, no value needed
6+
# https://docs.github.com/en/actions/using-workflows/reusing-workflows
7+
8+
jobs:
9+
bundler_tests:
10+
name: Verify Copy Task
11+
runs-on: 'ubuntu-22.04'
12+
steps:
13+
- name: Checkout Code
14+
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
15+
16+
- name: Get Core Dependencies
17+
uses: ./.github/workflows/actions/get-core-dependencies
18+
19+
- name: Download Build Archive
20+
uses: ./.github/workflows/actions/download-archive
21+
with:
22+
name: stencil-core
23+
path: .
24+
filename: stencil-core-build.zip
25+
26+
- name: Bundler Tests
27+
run: npm run test.copytask
28+
shell: bash
29+
30+
- name: Check Git Context
31+
uses: ./.github/workflows/actions/check-git-context

src/compiler/output-targets/copy/output-copy.ts

+9-3
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,15 @@ import { canSkipAssetsCopy, getComponentAssetsCopyTasks } from './assets-copy-ta
66
import { getDestAbsPath, getSrcAbsPath } from './local-copy-tasks';
77

88
const DEFAULT_IGNORE = [
9-
'**/__mocks__/**', '**/__fixtures__/**', '**/dist/**', '**/.{idea,git,cache,output,temp}/**',
10-
'**/.ds_store', '**/.gitignore', '**/desktop.ini', '**/thumbs.db'
11-
]
9+
'**/__mocks__/**',
10+
'**/__fixtures__/**',
11+
'**/dist/**',
12+
'**/.{idea,git,cache,output,temp}/**',
13+
'**/.ds_store',
14+
'**/.gitignore',
15+
'**/desktop.ini',
16+
'**/thumbs.db',
17+
];
1218

1319
export const outputCopy = async (config: d.ValidatedConfig, compilerCtx: d.CompilerCtx, buildCtx: d.BuildCtx) => {
1420
const outputTargets = config.outputTargets.filter(isOutputTargetCopy);

src/sys/node/node-copy-tasks.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,7 @@ export async function nodeCopyTasks(copyTasks: Required<d.CopyTask>[], srcDir: s
4545
}
4646

4747
async function processGlobTask(copyTask: Required<d.CopyTask>, srcDir: string): Promise<Required<d.CopyTask>[]> {
48-
const pattern = isGlob(copyTask.src)
49-
? copyTask.src
50-
: path.join(copyTask.src, '**');
48+
const pattern = isGlob(copyTask.src) ? copyTask.src : path.join(copyTask.src, '**');
5149

5250
const files = await asyncGlob(pattern, {
5351
cwd: srcDir,
+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export const copyFile = jest.fn().mockImplementation(() => 'JavaScript file content');;
1+
export const copyFile = jest.fn().mockImplementation(() => 'JavaScript file content');

test/copy-task/stencil.config.ts

+8-6
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@ export const config: Config = {
55
outputTargets: [
66
{
77
type: 'dist-custom-elements',
8-
copy: [{
9-
src: './utils',
10-
dest: './dist/utilsExtra',
11-
}]
8+
copy: [
9+
{
10+
src: './utils',
11+
dest: './dist/utilsExtra',
12+
},
13+
],
1214
},
1315
{
14-
type: 'dist'
15-
}
16+
type: 'dist',
17+
},
1618
],
1719
};

0 commit comments

Comments
 (0)