Skip to content

Commit 62272ad

Browse files
filipesilvamgechev
authored andcommitted
build: fix bazel tests to run on windows
1 parent e5f7de8 commit 62272ad

File tree

4 files changed

+9
-8
lines changed

4 files changed

+9
-8
lines changed

packages/angular_devkit/core/BUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ ts_library(
5656
"src/**/*_spec_large.ts",
5757
],
5858
),
59-
data = [
59+
data = glob(["src/workspace/json/test/**/*.json"]) + [
6060
"src/experimental/workspace/test/test-workspace.json",
6161
"src/experimental/workspace/workspace-schema.json",
6262
],

packages/angular_devkit/core/src/workspace/json/reader_spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const basicFile = stripIndent`
2828
"x-bar": 5,
2929
}`;
3030

31-
const representativeFile = readFileSync(__dirname + '/test/angular.json', 'utf8');
31+
const representativeFile = readFileSync(require.resolve(__dirname + '/test/angular.json'), 'utf8');
3232

3333
function createTestHost(content: string, onWrite?: (path: string, data: string) => void) {
3434
return {

packages/angular_devkit/core/src/workspace/json/writer_spec.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const basicFile = stripIndent`
3030
"x-bar": 5,
3131
}`;
3232

33-
const representativeFile = readFileSync(__dirname + '/test/angular.json', 'utf8');
33+
const representativeFile = readFileSync(require.resolve(__dirname + '/test/angular.json'), 'utf8');
3434

3535
function createTestCaseHost(inputData = '') {
3636
const host = {
@@ -39,7 +39,8 @@ function createTestCaseHost(inputData = '') {
3939
},
4040
async writeFile(path: string, data: string) {
4141
try {
42-
const testCase = readFileSync(join(__dirname, 'test', 'cases', path) + '.json', 'utf8');
42+
const testCase = readFileSync(
43+
require.resolve(join(__dirname, 'test', 'cases', path) + '.json'), 'utf8');
4344
expect(data).toEqual(testCase);
4445
} catch (e) {
4546
fail(`Unable to load test case '${path}': ${e.message || e}`);

packages/schematics/angular/no_typescript_runtime_dep_spec.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
const fs = require('fs');
1010
const path = require('path');
1111

12-
const pkg = path.join('packages', 'schematics', 'angular');
12+
const pkg = path.dirname(require.resolve(__filename));
1313
describe('@schematics/angular javascript code', () => {
1414
fs.readdirSync(pkg).forEach(d => {
1515
const dir = path.join(pkg, d);
@@ -21,10 +21,10 @@ describe('@schematics/angular javascript code', () => {
2121
const file = path.join(subdir, f);
2222
if (fs.statSync(file).isDirectory()) {
2323
check(file);
24-
} else if (file.endsWith('.js')) {
24+
} else if (file.endsWith('.ts')) {
2525
const content = fs.readFileSync(file, { encoding: 'utf-8' });
26-
if (content.indexOf('require("typescript")') >= 0) {
27-
fail(`${file} has a typescript require`);
26+
if (content.indexOf(`from 'typescript'`) >= 0) {
27+
fail(`${file} has a typescript import`);
2828
}
2929
}
3030
});

0 commit comments

Comments
 (0)