Skip to content
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

Unflag t.like() assertion #2550

Merged
merged 1 commit into from Jul 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
24 changes: 0 additions & 24 deletions docs/03-assertions.md
Expand Up @@ -215,30 +215,6 @@ Instead AVA derives a *comparable* object from `value`, based on the deeply-nest

Any values in `selector` that are not regular objects should be deeply equal to the corresponding values in `value`.

This is an experimental assertion for the time being. You need to enable it:

**`package.json`**:

```json
{
"ava": {
"nonSemVerExperiments": {
"likeAssertion": true
}
}
}
```

**`ava.config.js`**:

```js
export default {
nonSemVerExperiments: {
likeAssertion: true
}
}
```

In the following example, the `map` property of `value` must be deeply equal to that of `selector`. However `nested.qux` is ignored, because it's not in `selector`.

```js
Expand Down
9 changes: 0 additions & 9 deletions lib/assert.js
Expand Up @@ -399,15 +399,6 @@ class Assertions {
});

this.like = withSkip((actual, selector, message) => {
if (!experiments.likeAssertion) {
fail(new AssertionError({
assertion: 'like',
improperUsage: true,
message: 'You must enable the `likeAssertion` experiment in order to use `t.like()`'
}));
return;
}

if (!checkMessage('like', message)) {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/load-config.js
Expand Up @@ -7,7 +7,7 @@ const pkgConf = require('pkg-conf');

const NO_SUCH_FILE = Symbol('no ava.config.js file');
const MISSING_DEFAULT_EXPORT = Symbol('missing default export');
const EXPERIMENTS = new Set(['disableSnapshotsInHooks', 'likeAssertion', 'reverseTeardowns']);
const EXPERIMENTS = new Set(['disableSnapshotsInHooks', 'reverseTeardowns']);

// *Very* rudimentary support for loading ava.config.js files containing an `export default` statement.
const evaluateJsConfig = configFile => {
Expand Down
4 changes: 1 addition & 3 deletions test-tap/assert.js
Expand Up @@ -31,9 +31,7 @@ const assertions = new class extends assert.Assertions {
lastFailure = error;
},
skip: () => {},
experiments: {
likeAssertion: true
},
experiments: {},
...overwrites
});
}
Expand Down
2 changes: 1 addition & 1 deletion test-tap/helper/report.js
Expand Up @@ -88,7 +88,7 @@ const run = (type, reporter, {match = [], filter} = {}) => {
serial: type === 'failFast' || type === 'failFast2',
require: [],
cacheEnabled: true,
experiments: {likeAssertion: true},
experiments: {},
match,
providers,
projectDir,
Expand Down
2 changes: 1 addition & 1 deletion test-tap/test.js
Expand Up @@ -648,7 +648,7 @@ test('log from tests', t => {

test('assertions are bound', t => {
// This does not test .fail() and .snapshot(). It'll suffice.
return withExperiments({likeAssertion: true})(a => {
return ava(a => {
(a.plan)(14);
(a.pass)();
(a.is)(1, 1);
Expand Down
5 changes: 1 addition & 4 deletions test/assertions/fixtures/package.json
Expand Up @@ -2,9 +2,6 @@
"ava": {
"files": [
"*.js"
],
"nonSemVerExperiments": {
"likeAssertion": true
}
]
}
}