mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-14 19:16:17 -06:00
Update build for node 6 to allow private package
This commit is contained in:
parent
17281d0200
commit
fb469e70cb
@ -23,6 +23,11 @@ install:
|
||||
- npm uninstall typescript --no-save
|
||||
- npm uninstall tslint --no-save
|
||||
- npm install
|
||||
- if [ "$TRAVIS_NODE_VERSION" = "6" ]; then
|
||||
npm uninstall typemock --no-save;
|
||||
npm run build:typemock;
|
||||
npm install file:scripts/typemock --no-save;
|
||||
fi
|
||||
|
||||
cache:
|
||||
directories:
|
||||
|
||||
21
Gulpfile.ts
21
Gulpfile.ts
@ -608,18 +608,15 @@ gulp.task("LKG", "Makes a new LKG out of the built js files", ["clean", "dontUse
|
||||
return runSequence("LKGInternal", "VerifyLKG");
|
||||
});
|
||||
|
||||
// NOTE: This build task is currently commented out as the approach to including typemock as a private
|
||||
// package does not seem to work in Node 6. If this issue cannot be resolved, this will be removed.
|
||||
//// gulp.task("typemock", () => {
|
||||
//// const typemock = tsc.createProject("scripts/typemock/tsconfig.json", getCompilerSettings({}, /*useBuiltCompiler*/ true));
|
||||
//// return typemock.src()
|
||||
//// .pipe(sourcemaps.init())
|
||||
//// .pipe(newer("scripts/typemock/dist"))
|
||||
//// .pipe(typemock())
|
||||
//// .pipe(sourcemaps.write(".", <any>{ includeContent: false, destPath: "scripts/typemock/dist" }))
|
||||
//// .pipe(gulp.dest("scripts/typemock/dist"));
|
||||
//// });
|
||||
gulp.task("typemock");
|
||||
gulp.task("typemock", () => {
|
||||
const typemock = tsc.createProject("scripts/typemock/tsconfig.json", getCompilerSettings({}, /*useBuiltCompiler*/ false));
|
||||
return typemock.src()
|
||||
.pipe(sourcemaps.init())
|
||||
.pipe(newer("scripts/typemock/dist"))
|
||||
.pipe(typemock())
|
||||
.pipe(sourcemaps.write(".", <any>{ includeContent: false, destPath: "scripts/typemock/dist" }))
|
||||
.pipe(gulp.dest("scripts/typemock/dist"));
|
||||
});
|
||||
|
||||
// Task to build the tests infrastructure using the built compiler
|
||||
const run = path.join(builtLocalDirectory, "run.js");
|
||||
|
||||
27
Jakefile.js
27
Jakefile.js
@ -779,21 +779,18 @@ task("LKG", ["clean", "release", "local"].concat(libraryTargets), function () {
|
||||
// Test directory
|
||||
directory(builtLocalDirectory);
|
||||
|
||||
// NOTE: This build task is currently commented out as the approach to including typemock as a private
|
||||
// package does not seem to work in Node 6. If this issue cannot be resolved, this will be removed.
|
||||
//// task("typemock", function () {
|
||||
//// var startCompileTime = mark();
|
||||
//// execCompiler(/*useBuiltCompiler*/ true, ["-p", "scripts/typemock/tsconfig.json"], function (error) {
|
||||
//// if (error) {
|
||||
//// fail("Compilation unsuccessful.");
|
||||
//// }
|
||||
//// else {
|
||||
//// complete();
|
||||
//// }
|
||||
//// measure(startCompileTime);
|
||||
//// });
|
||||
//// }, { async: true });
|
||||
task("typemock");
|
||||
task("typemock", function () {
|
||||
var startCompileTime = mark();
|
||||
execCompiler(/*useBuiltCompiler*/ false, ["-p", "scripts/typemock/tsconfig.json"], function (error) {
|
||||
if (error) {
|
||||
fail("Compilation unsuccessful.");
|
||||
}
|
||||
else {
|
||||
complete();
|
||||
}
|
||||
measure(startCompileTime);
|
||||
});
|
||||
}, { async: true });
|
||||
|
||||
// Task to build the tests infrastructure using the built compiler
|
||||
var run = path.join(builtLocalDirectory, "run.js");
|
||||
|
||||
@ -9,5 +9,13 @@ nvm install $1
|
||||
npm uninstall typescript --no-save
|
||||
npm uninstall tslint --no-save
|
||||
npm install
|
||||
|
||||
# Node 6 uses an older version of npm that does not symlink a package with a "file:" reference
|
||||
if [ "$1" = "6" ]; then
|
||||
npm uninstall typemock --no-save;
|
||||
npm run build:typemock;
|
||||
npm install file:scripts/typemock --no-save;
|
||||
fi
|
||||
|
||||
npm update
|
||||
npm test
|
||||
|
||||
@ -91,6 +91,7 @@
|
||||
"build": "npm run build:compiler && npm run build:tests",
|
||||
"build:compiler": "jake local",
|
||||
"build:tests": "jake tests",
|
||||
"build:typemock": "jake typemock",
|
||||
"start": "node lib/tsc",
|
||||
"clean": "jake clean",
|
||||
"gulp": "gulp",
|
||||
|
||||
@ -114,7 +114,7 @@ export class Arg {
|
||||
public static includes(value: string): string & string[] & Arg;
|
||||
public static includes<T>(value: T): T[] & Arg;
|
||||
public static includes<T>(value: T): Arg {
|
||||
return new Arg(value_ => Array.isArray(value_) ? value_.includes(value) : typeof value_ === "string" && value_.includes("" + value), `contains ${value}`);
|
||||
return new Arg(value_ => Array.isArray(value_) ? value_.indexOf(value) >= 0 : typeof value_ === "string" && value_.includes("" + value), `contains ${value}`);
|
||||
}
|
||||
|
||||
public static array<T>(values: (T | T & Arg)[]): T[] & Arg {
|
||||
|
||||
@ -174,7 +174,7 @@ export class Mock<T extends object> {
|
||||
if (times === undefined) {
|
||||
times = Times.atLeastOnce();
|
||||
}
|
||||
this._handler.verify(callback, times);
|
||||
this._handler.verify(callback, times, message);
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -294,7 +294,7 @@ class Recording {
|
||||
public match(trap: string, name: PropertyKey | undefined, thisArg: any, argArray: any, newTarget: any) {
|
||||
return this.trap === trap
|
||||
&& this.name === name
|
||||
&& Arg.validate(this.thisCondition, thisArg)
|
||||
&& this.matchThisArg(thisArg)
|
||||
&& Arg.validateAll(this.argConditions, argArray)
|
||||
&& Arg.validate(this.newTargetCondition, newTarget);
|
||||
}
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
import "./sourceMapSupport";
|
||||
import { Mock } from "../mock";
|
||||
import { Inject } from "../inject";
|
||||
import { Arg } from "../arg";
|
||||
import { Times } from "../times";
|
||||
import { recordError } from "./utils";
|
||||
@ -107,7 +106,7 @@ describe("mock", () => {
|
||||
// arrange
|
||||
const target = { a: 1 };
|
||||
const error = new Error("error");
|
||||
const mock = new Mock(target, { set a(value: number) { throw error; } });
|
||||
const mock = new Mock(target, { set a(_: number) { throw error; } });
|
||||
|
||||
// act
|
||||
const e = recordError(() => mock.proxy.a = 2);
|
||||
@ -218,7 +217,7 @@ describe("mock", () => {
|
||||
});
|
||||
it("function", () => {
|
||||
// arrange
|
||||
const mock = new Mock<(x: number) => number>(x => 0);
|
||||
const mock = new Mock<(x: number) => number>(_ => 0);
|
||||
mock.setup(_ => _(Arg.number()), { return: 2 });
|
||||
|
||||
// act
|
||||
@ -248,7 +247,7 @@ describe("mock", () => {
|
||||
// arrange
|
||||
const target = { a: 1 };
|
||||
const mock = new Mock(target);
|
||||
const result = mock.proxy.a;
|
||||
mock.proxy.a;
|
||||
|
||||
// act
|
||||
const e = recordError(() => mock.verify(_ => _.a, Times.once()));
|
||||
@ -298,7 +297,7 @@ describe("mock", () => {
|
||||
// arrange
|
||||
const target = { a() { return 1; } };
|
||||
const mock = new Mock(target);
|
||||
const result = mock.proxy.a();
|
||||
mock.proxy.a();
|
||||
|
||||
// act
|
||||
const e = recordError(() => mock.verify(_ => _.a(), Times.once()));
|
||||
@ -321,7 +320,7 @@ describe("mock", () => {
|
||||
it("called passes", () => {
|
||||
// arrange
|
||||
const mock = Mock.function();
|
||||
const result = mock.proxy();
|
||||
mock.proxy();
|
||||
|
||||
// act
|
||||
const e = recordError(() => mock.verify(_ => _(), Times.once()));
|
||||
@ -335,7 +334,7 @@ describe("mock", () => {
|
||||
// arrange
|
||||
const target = { a: 1 };
|
||||
const mock = new Mock(target, { get a() { return 2 } });
|
||||
const result = mock.proxy.a;
|
||||
mock.proxy.a;
|
||||
|
||||
// act
|
||||
const e = recordError(() => mock.verify(_ => _.a, Times.once()));
|
||||
@ -351,7 +350,7 @@ describe("mock", () => {
|
||||
return x + 2;
|
||||
}
|
||||
});
|
||||
const result = mock.proxy.a(3);
|
||||
mock.proxy.a(3);
|
||||
|
||||
// act
|
||||
const e = recordError(() => mock.verify(_ => _.a(Arg.number()), Times.once()));
|
||||
|
||||
@ -1,10 +1,12 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es2017",
|
||||
"target": "es2015",
|
||||
"strict": true,
|
||||
"declaration": true,
|
||||
"sourceMap": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"types": ["mocha"],
|
||||
"newLine": "LF",
|
||||
"outDir": "dist"
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user