Skip to content

Commit 8ea355e

Browse files
committed
Fix some tests.
1 parent 1dc41ed commit 8ea355e

File tree

2 files changed

+42
-7
lines changed

2 files changed

+42
-7
lines changed

apps/api-extractor/config/heft.json

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/**
2+
* Defines configuration used by core Heft.
3+
*/
4+
{
5+
"$schema": "https://developer.microsoft.com/json-schemas/heft/heft.schema.json",
6+
7+
/**
8+
* Optionally specifies another JSON config file that this file extends from. This provides a way for standard
9+
* settings to be shared across multiple projects.
10+
*/
11+
"extends": "@rushstack/heft-node-rig/profiles/default/config/heft.json",
12+
13+
"phasesByName": {
14+
"build": {
15+
"tasksByName": {
16+
"perform-copy": {
17+
"taskEvent": {
18+
"eventKind": "copyFiles",
19+
"options": {
20+
"copyOperations": [
21+
{
22+
"sourcePath": "src",
23+
"destinationFolders": ["lib"],
24+
"includeGlobs": ["**/test/test-data/**/*"]
25+
}
26+
]
27+
}
28+
}
29+
}
30+
}
31+
}
32+
}
33+
}

apps/heft/src/utilities/test/GitUtilities.test.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
import * as path from 'path';
22
import { GitUtilities, type GitignoreFilterFn } from '../GitUtilities';
3+
import { PackageJsonLookup } from '@rushstack/node-core-library';
34

45
describe('GitUtilities', () => {
56
describe('checkIgnoreAsync', () => {
6-
const testFoldersBasePath: string = path.join(__dirname, 'checkIgnoreTests');
7+
const projectRoot: string = PackageJsonLookup.instance.tryGetPackageFolderFor(__dirname)!;
8+
9+
const testFoldersBasePath: string = `${projectRoot}/src/utilities/test/checkIgnoreTests`;
710

811
it('returns all files are ignored', async () => {
912
const testFolderPath: string = path.join(testFoldersBasePath, 'allIgnored');
@@ -37,13 +40,12 @@ describe('GitUtilities', () => {
3740

3841
it('returns ignored files specified in the repo gitignore', async () => {
3942
// <repoRoot>/apps/heft
40-
const testFolderPath: string = path.resolve(__dirname, '..', '..', '..');
41-
const git = new GitUtilities(testFolderPath);
43+
const git = new GitUtilities(projectRoot);
4244
const isUnignoredAsync: GitignoreFilterFn = (await git.tryCreateGitignoreFilterAsync())!;
43-
expect(await isUnignoredAsync(path.join(testFolderPath, 'lib', 'a.txt'))).toEqual(false);
44-
expect(await isUnignoredAsync(path.join(testFolderPath, 'temp', 'a.txt'))).toEqual(false);
45-
expect(await isUnignoredAsync(path.join(testFolderPath, 'dist', 'a.txt'))).toEqual(false);
46-
expect(await isUnignoredAsync(path.join(testFolderPath, 'src', 'a.txt'))).toEqual(true);
45+
expect(await isUnignoredAsync(path.join(projectRoot, 'lib', 'a.txt'))).toEqual(false);
46+
expect(await isUnignoredAsync(path.join(projectRoot, 'temp', 'a.txt'))).toEqual(false);
47+
expect(await isUnignoredAsync(path.join(projectRoot, 'dist', 'a.txt'))).toEqual(false);
48+
expect(await isUnignoredAsync(path.join(projectRoot, 'src', 'a.txt'))).toEqual(true);
4749

4850
const ignoredFolderPath: string = path.join(testFoldersBasePath, 'allIgnored');
4951
expect(await isUnignoredAsync(path.join(ignoredFolderPath, 'a.txt'))).toEqual(false);

0 commit comments

Comments
 (0)