Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tsc-watch

Package Overview
Dependencies
Maintainers
1
Versions
92
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tsc-watch - npm Package Compare versions

Comparing version 1.0.17 to 1.0.18

test/driver.js

3

CHANGELOG.md
# @gilamran/tsc-watch CHANGELOG
## v1.0.18 - 8/04/2018
* Fixed passing compilation when using --pretty param (Thanks to @tomaba)
## v1.0.17 - 27/01/2018

@@ -4,0 +7,0 @@ * Terminating typescript on SIGTERM event (Thanks to @amir-arad)

2

lib/tsc-watch.js

@@ -12,3 +12,3 @@ #!/usr/bin/env node

const typescriptWatchCommandRegex = /Watch input files\./;
const typescriptErrorRegex = /\(\d+,\d+\): error TS\d+:/;
const typescriptErrorRegex = /\(\d+,\d+\): .*error.*TS\d+:/;
const onSuccessCommandSyntax = ' --onSuccess COMMAND Run the COMMAND on each successful compilation';

@@ -15,0 +15,0 @@ const onFirstSuccessCommandSyntax = ' --onFirstSuccess COMMAND Run the COMMAND on the first successful compilation (Will not run the onSuccess)';

{
"name": "tsc-watch",
"version": "1.0.17",
"version": "1.0.18",
"description": "The TypeScript compiler with onSuccess command",

@@ -5,0 +5,0 @@ "scripts": {

@@ -6,3 +6,3 @@ const { expect } = require('chai');

const tscWatchClient = require('../lib/client');
const { driver: tscWatchDriver } = require('./tsc-watch.it.js');
const { driver: tscWatchDriver } = require('./driver.js');

@@ -9,0 +9,0 @@ describe('Client Events', () => {

@@ -1,9 +0,7 @@

const { fork } = require('child_process');
const { expect } = require('chai');
const sinon = require('sinon');
const mochaEventually = require('mocha-eventually');
const fs = require('fs');
const { driver } = require('./driver');
const eventually = fn => mochaEventually(fn, 4000, 10);
const subscriptions = new Map();

@@ -43,54 +41,11 @@ describe('TSC-Watch child process messages', () => {

});
});
it('Should send "compile_errors" when pretty param was set', () => {
driver
.subscribe('compile_errors', this.listener)
.startWatch({ failFirst: true, pretty: true });
const driver = {
noop: () => {},
wait: Promise.resolve(),
successFilePath: './tmp/fixtures/passing.ts',
failFilePath: './tmp/fixtures/failing.ts',
successSuffix: ' ',
failSuffix: '{{{',
subscribe: (processEventName, listener) => {
subscriptions.set(processEventName, listener);
return driver;
},
startWatch: ({failFirst} = {}) => {
driver.proc = fork('./lib/tsc-watch.js', ['--out', './tmp/output.js', failFirst ? driver.failFilePath : driver.successFilePath], { stdio: 'inherit' });
subscriptions.forEach((handler, evName) =>
driver.proc.on('message', event => evName === event
? handler(event)
: driver.noop()));
return driver;
},
modifyAndSucceedAfter: (wait = 0, isFailingPath) => {
driver._extendWait(wait).then(() => fs.appendFileSync(driver.successFilePath, driver.successSuffix));
return driver;
},
modifyAndFailAfter: (wait = 0) => {
driver._extendWait(wait).then(() => fs.appendFileSync(driver.failFilePath, driver.failSuffix));
return driver;
},
reset: () => {
if (driver.proc && driver.proc.kill) {
driver.proc.kill();
delete driver.proc;
}
subscriptions.clear();
driver.wait = Promise.resolve();
return driver;
},
_extendWait: ms => driver.wait = driver.wait.then(() => new Promise(resolve => setTimeout(resolve, ms)))
};
module.exports.driver = driver;
return eventually(() =>
expect(this.listener.callCount).to.be.equal(1));
});
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc