From b337c38bc1260bbeb9951d6d6d90b02ed2c4e0d5 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Tue, 24 Mar 2020 09:37:46 -0700 Subject: [PATCH 1/5] [Tests] on node 12 and 13, drop 11; require iojs and 0.12 to pass --- .travis.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index a84e7ef..a569a2d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,8 @@ language: node_js os: - linux node_js: - - "11" + - "13" + - "12" - "10" - "8" - "6" @@ -31,6 +32,4 @@ matrix: - node_js: "lts/*" env: COVERAGE=true allow_failures: - - node_js: "iojs" - - node_js: "0.12" - node_js: "0.10" From c30b1a7011b7806044c755fe178f011229343424 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Tue, 24 Mar 2020 09:44:16 -0700 Subject: [PATCH 2/5] [Deps] update `bluebird`, `glob` --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index a54e944..39eb4cc 100644 --- a/package.json +++ b/package.json @@ -66,10 +66,10 @@ }, "dependencies": { "airbnb-js-shims": "^2 || ^3", - "bluebird": "^3.5.5", + "bluebird": "^3.7.2", "body-parser": "^1.19.0", "express": "^4.17.1", - "glob": "^7.1.4", + "glob": "^7.1.6", "has": "^1.0.3", "lru-cache": "^4.1.5", "object.assign": "^4.1.0", From 7ed522095ae12fff79527a8617fb27f0c3c0f5eb Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Tue, 24 Mar 2020 09:48:06 -0700 Subject: [PATCH 3/5] [Dev Deps] update `eslint`, `eslint-config-airbnb-base`, `in-publish`, `rimraf`, `safe-publish-latest` --- package.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 39eb4cc..c3996cc 100644 --- a/package.json +++ b/package.json @@ -52,15 +52,15 @@ "babel-preset-airbnb": "^2.5.3", "chai": "^4.2.0", "cheerio": "^1.0.0-rc.3", - "eslint": "^5.16.0", - "eslint-config-airbnb-base": "^13.1.0", + "eslint": "^6.8.0", + "eslint-config-airbnb-base": "^14.1.0", "eslint-plugin-import": "^2.17.3", - "in-publish": "^2.0.0", + "in-publish": "^2.0.1", "istanbul": "^1.0.0-alpha.2", "mocha": "^3.5.3", "mocha-wrap": "^2.1.2", - "rimraf": "^2.6.3", - "safe-publish-latest": "^1.1.2", + "rimraf": "^2.7.1", + "safe-publish-latest": "^1.1.4", "sinon": "^3.3.0", "sinon-sandbox": "^1.0.2" }, From 00c4b0f9faa1106c6edd3917ce26562a669d5d50 Mon Sep 17 00:00:00 2001 From: Johannes Burghardt Date: Fri, 11 Oct 2019 10:19:50 +0200 Subject: [PATCH 4/5] [Fix] escape closing `', '>'], + [' { it('escapes', () => { - const html = serialize('foo', '', { foo: '', bar: '>' }); + const html = serialize('foo', '', { foo: '', bar: '>', baz: ' ({})) - .describe('with fromScript', () => { - it('loads the escaped content correctly', () => { - const html = toScript({ a: 'b' }, { foo: '', bar: '>', baz: '&' }); - const $ = cheerio.load(html); + .withGlobal('document', () => ({})) + .describe('with fromScript', () => { + it('loads the escaped content correctly', () => { + const html = toScript({ a: 'b' }, { foo: '', bar: '>', baz: '&', foobar: ' ({ innerHTML: $($('script')[0]).html() }); + global.document.querySelector = () => ({ innerHTML: $($('script')[0]).html() }); - const res = fromScript({ - a: 'b', - }); - - assert.isObject(res); + const res = fromScript({ + a: 'b', + }); - assert.equal(res.foo, ''); - assert.equal(res.bar, '>'); - assert.equal(res.baz, '&'); - }); + assert.isObject(res); - it('escapes multiple times the same, with interleaved decoding', () => { - const makeHTML = () => toScript({ attr: 'key' }, { - props: 'yay', - needsEncoding: '" > ', // "needsEncoding" is necessary + assert.equal(res.foo, ''); + assert.equal(res.bar, '>'); + assert.equal(res.baz, '&'); + assert.equal(res.foobar, ' { + const makeHTML = () => toScript({ attr: 'key' }, { + props: 'yay', + needsEncoding: '" > ', // "needsEncoding" is necessary + }); + const script1 = makeHTML(); + const script2 = makeHTML(); + assert.equal(script1, script2, 'two successive toScripts result in identical HTML'); - global.document.querySelector = () => ({ innerHTML: $($('script')[0]).html() }); + const $ = cheerio.load(script1); - const res = fromScript({ attr: 'key' }); + global.document.querySelector = () => ({ innerHTML: $($('script')[0]).html() }); - const script3 = makeHTML(); - assert.equal( - script1, - script3, - 'third toScript after a fromScript call results in the same HTML', - ); + const res = fromScript({ attr: 'key' }); - assert.isObject(res); + const script3 = makeHTML(); + assert.equal( + script1, + script3, + 'third toScript after a fromScript call results in the same HTML', + ); - assert.equal(res.props, 'yay'); + assert.isObject(res); + + assert.equal(res.props, 'yay'); + }); }); - }); it('escapes quotes and fixes data attributes', () => { const markup = toScript({ From 34bd5ecabb9111ceace958a7a58ae9955a51c05b Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Tue, 24 Mar 2020 11:20:37 -0700 Subject: [PATCH 5/5] do not merge: more npm ls output --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index a569a2d..5adba9d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,7 +15,7 @@ before_install: - 'nvm install-latest-npm' install: - 'if [ "${TRAVIS_NODE_VERSION}" = "0.6" ]; then nvm install --latest-npm 0.8 && npm install && nvm use "${TRAVIS_NODE_VERSION}"; else npm install; fi;' - - 'npm ls > /dev/null' + - 'npm prune && npm ls' # > /dev/null' script: - 'if [ -n "${PRETEST-}" ]; then npm run pretest ; fi' - 'if [ -n "${POSTTEST-}" ]; then npm run posttest ; fi'