Skip to content

Commit f9050ba

Browse files
committed
test: add non unit tests on windows due to ubuntu setup issues
1 parent 4434d94 commit f9050ba

File tree

7 files changed

+125
-13
lines changed

7 files changed

+125
-13
lines changed

.github/workflows/non-release-build.yml

Lines changed: 0 additions & 10 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,18 @@ permissions:
1010
jobs:
1111
unit-tests:
1212
uses: salesforcecli/github-workflows/.github/workflows/unitTest.yml@main
13-
13+
nuts:
14+
needs: unit-tests
15+
uses: salesforcecli/github-workflows/.github/workflows/nut.yml@main
16+
secrets: inherit
17+
strategy:
18+
matrix:
19+
os: [windows-latest]
20+
fail-fast: false
21+
with:
22+
os: ${{ matrix.os }}
1423
release:
15-
needs: [unit-tests]
24+
needs: [unit-tests, nuts]
1625
name: Release
1726
runs-on: ubuntu-latest
1827
steps:

.github/workflows/test.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Test
2+
on:
3+
push:
4+
branches-ignore:
5+
- main
6+
jobs:
7+
unit-tests:
8+
uses: salesforcecli/github-workflows/.github/workflows/unitTest.yml@main
9+
nuts:
10+
needs: unit-tests
11+
uses: salesforcecli/github-workflows/.github/workflows/nut.yml@main
12+
secrets: inherit
13+
strategy:
14+
matrix:
15+
os: [windows-latest]
16+
fail-fast: false
17+
with:
18+
os: ${{ matrix.os }}

package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@
4747
"commands": "./lib/commands",
4848
"bin": "sf",
4949
"topicSeparator": " ",
50+
"topics": {
51+
"apex-tests-git-delta": {
52+
"description": "description for apex-tests-git-delta"
53+
}
54+
},
5055
"devPlugins": [
5156
"@oclif/plugin-help"
5257
],
@@ -58,7 +63,7 @@
5863
"clean": "sf-clean",
5964
"clean-all": "sf-clean all",
6065
"clean:lib": "shx rm -rf lib && shx rm -rf coverage && shx rm -rf .nyc_output && shx rm -f oclif.manifest.json oclif.lock",
61-
"compile": "sf-compile",
66+
"compile": "wireit",
6267
"docs": "sf-docs",
6368
"format": "sf-format",
6469
"lint": "wireit",

test/commands/delta/delta.nut.ts

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
'use strict';
2+
3+
import { rm } from 'node:fs/promises';
4+
5+
import { execCmd, TestSession } from '@salesforce/cli-plugins-testkit';
6+
import { expect } from 'chai';
7+
8+
import { createTemporaryCommit } from './createTemporaryCommit.js';
9+
import { setupTestRepo } from './setupTestRepo.js';
10+
11+
describe('apex-tests-git-delta NUTs', () => {
12+
let session: TestSession;
13+
let tempDir: string;
14+
const originalDir = process.cwd();
15+
16+
before(async () => {
17+
session = await TestSession.create({ devhubAuthStrategy: 'NONE' });
18+
tempDir = await setupTestRepo();
19+
await createTemporaryCommit(
20+
'chore: initial commit with Apex::TestClass00::Apex',
21+
'force-app/main/default/classes/SandboxTest.cls',
22+
'dummy 1'
23+
);
24+
await createTemporaryCommit(
25+
'chore: initial commit with Apex::SandboxTest::Apex',
26+
'force-app/main/default/classes/TestClass3.cls',
27+
'dummy 11'
28+
);
29+
await createTemporaryCommit(
30+
'chore: adding new tests Apex::TestClass3 TestClass4::Apex',
31+
'packaged/classes/TestClass4.cls',
32+
'dummy 2'
33+
);
34+
});
35+
36+
after(async () => {
37+
await session?.clean();
38+
process.chdir(originalDir);
39+
await rm(tempDir, { recursive: true });
40+
});
41+
42+
it('runs delta command and returns the tests.', async () => {
43+
const command = 'apex-tests-git-delta delta --from "HEAD~2" --to "HEAD"';
44+
const output = execCmd(command, { ensureExitCode: 0 }).shellOutput.stdout;
45+
46+
expect(output.replace('\n', '')).to.equal('SandboxTest TestClass3 TestClass4');
47+
});
48+
});
File renamed without changes.

test/commands/delta/empty.nut.ts

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
'use strict';
2+
3+
import { rm } from 'node:fs/promises';
4+
5+
import { execCmd, TestSession } from '@salesforce/cli-plugins-testkit';
6+
import { expect } from 'chai';
7+
8+
import { createTemporaryCommit } from './createTemporaryCommit.js';
9+
import { setupTestRepo } from './setupTestRepo.js';
10+
11+
describe('apex-tests-git-delta empty string NUT', () => {
12+
let session: TestSession;
13+
let fromSha: string;
14+
let toSha: string;
15+
let tempDir: string;
16+
const originalDir = process.cwd();
17+
18+
before(async () => {
19+
session = await TestSession.create({ devhubAuthStrategy: 'NONE' });
20+
tempDir = await setupTestRepo();
21+
fromSha = await createTemporaryCommit(
22+
'chore: initial commit',
23+
'force-app/main/default/classes/SandboxTest.cls',
24+
'dummy 1'
25+
);
26+
await createTemporaryCommit('chore: add a class', 'force-app/main/default/classes/TestClass3.cls', 'dummy 11');
27+
toSha = await createTemporaryCommit('chore: add some tests', 'packaged/classes/TestClass4.cls', 'dummy 2');
28+
});
29+
30+
after(async () => {
31+
await session?.clean();
32+
process.chdir(originalDir);
33+
await rm(tempDir, { recursive: true });
34+
});
35+
36+
it('runs delta command and returns no tests.', async () => {
37+
const command = `apex-tests-git-delta delta --from "${fromSha}" --to "${toSha}"`;
38+
const output = execCmd(command, { ensureExitCode: 0 }).shellOutput.stdout;
39+
40+
expect(output.replace('\n', '')).to.equal('');
41+
});
42+
});

0 commit comments

Comments
 (0)