https://drive.google.com/open?id=1IayEFjUReATiuJI8CD6hBQRPGR7iIrFZ
app.component.spec.tsliqiang372
- Node 8+
- NPM or yarn
- Git
- Safari, Chrome, Firefox
cd topcoder-jest-test
git checkout formdata
npm install
npm run testnpm run test:jestChrome, Safari, Firefox
| Browser | Result |
|---|---|
| Chrome 72.0.3626 (Mac OS X 10.13.4) | success |
| Safari 11.1.0 (Mac OS X 10.13.4) | success |
| Firefox 65.0.0 (Mac OS X 10.13.0) | success |
FAIL src/app/app.component.spec.ts
AppComponent
✕ should create the app (94ms)
● AppComponent › should create the app
TypeError: Cannot read property 'replace' of null
25 | // input.value = 'hi' // if you uncomment this, the test will passs
26 | form.appendChild(input);
> 27 | const formData = new FormData(form);
| ^
28 |
29 | const hasFoo = formData.has('foo');
30 | expect(hasFoo).to.equal(true);
at exports.normalizeToCRLF.string (node_modules/jsdom/lib/jsdom/living/helpers/form-controls.js:60:17)
at src/app/app.component.spec.ts:27:22
Test Suites: 1 failed, 1 total
Tests: 1 failed, 1 total
Snapshots: 0 total
Time: 2.476sExpecting formData accepts form even input has no value
This is a bug in JSDOM FormData implementation, see line 149 and 163
Issue: jsdom/jsdom#2523