-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
function types: optional and vararg arguments. #650
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/** | ||
* @license | ||
* Copyright Google Inc. All Rights Reserved. | ||
* | ||
* Use of this source code is governed by an MIT-style license that can be | ||
* found in the LICENSE file at https://angular.io/license | ||
*/ | ||
|
||
/** | ||
* @fileoverview Minimal type declarations for the chai-diff library. | ||
* @see https://www.npmjs.com/package/chai-diff | ||
*/ | ||
|
||
declare namespace Chai { | ||
interface Assertion { | ||
differentFrom(val: string, opts?: {}): void; | ||
} | ||
} | ||
|
||
declare module 'chai-diff' { | ||
// tslint:disable-next-line:no-any This is the type defined by chai.use. | ||
function chaiDiff(chai: any, utils: any): void; | ||
export = chaiDiff; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,9 @@ | |
* found in the LICENSE file at https://angular.io/license | ||
*/ | ||
|
||
import {expect} from 'chai'; | ||
import {expect, use as chaiUse} from 'chai'; | ||
// tslint:disable-next-line:no-require-imports chai-diff needs a CommonJS import. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How come? You can There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's a wontfix TypeScript issue about it: |
||
import chaiDiff = require('chai-diff'); | ||
import * as fs from 'fs'; | ||
import * as path from 'path'; | ||
import * as ts from 'typescript'; | ||
|
@@ -16,6 +18,8 @@ import {normalizeLineEndings} from '../src/util'; | |
|
||
import * as testSupport from './test_support'; | ||
|
||
chaiUse(chaiDiff); | ||
|
||
// Set TEST_FILTER=foo to only run tests from the foo package. | ||
// Set TEST_FILTER=foo/bar to also filter for the '/bar' file. | ||
const TEST_FILTER = (() => { | ||
|
@@ -92,7 +96,7 @@ function compareAgainstGolden( | |
} | ||
} | ||
} else { | ||
expect(output).to.equal(golden, `${goldenPath}`); | ||
expect(output).not.differentFrom(golden!, {}); | ||
} | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is good, but FWIW in my experience it's easier to just let the thing write out new goldens and examine the output with 'git diff'.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I'm interactively tweaking the emit, I find it much easier to see a good diff there than re-gen the goldens. That also runs a high risk of missing a change. But I understand workflows are different.