Skip to content

Commit

Permalink
[Tests] add implementation test; run es-shim-api in postlint; use…
Browse files Browse the repository at this point in the history
… `tape` runner
  • Loading branch information
ljharb committed Nov 21, 2020
1 parent 48d0fe3 commit 3c9330b
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 5 deletions.
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,11 @@
"main": "index.js",
"scripts": {
"lint": "eslint .",
"pretest": "npm run lint && es-shim-api --bound",
"postlint": "es-shim-api --bound",
"pretest": "npm run lint",
"test": "npm run tests-only",
"posttest": "npx aud --production",
"tests-only": "npm run --silent test:shimmed && npm run --silent test:module",
"test:shimmed": "node test/shimmed",
"test:module": "node test",
"posttest": "aud --production",
"tests-only": "tape 'test/**/*.js'",
"version": "auto-changelog && git add CHANGELOG.md",
"postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""
},
Expand Down Expand Up @@ -49,6 +48,7 @@
"auto-changelog": "^2.2.1",
"eslint": "^7.11.0",
"functions-have-names": "^1.2.1",
"has-strict-mode": "^1.0.0",
"tape": "^5.0.1"
},
"auto-changelog": {
Expand Down
20 changes: 20 additions & 0 deletions test/implementation.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
'use strict';

var implementation = require('../implementation');
var callBind = require('es-abstract/helpers/callBind');
var test = require('tape');
var hasStrictMode = require('has-strict-mode')();
var runTests = require('./tests');

test('as a function', function (t) {
t.test('bad array/this value', { skip: !hasStrictMode }, function (st) {
/* eslint no-useless-call: 0 */
st['throws'](function () { implementation.call(undefined); }, TypeError, 'undefined is not an object');
st['throws'](function () { implementation.call(null); }, TypeError, 'null is not an object');
st.end();
});

runTests(callBind(implementation), t);

t.end();
});

0 comments on commit 3c9330b

Please sign in to comment.