diff --git a/jest.config.js b/jest.config.js index 5d62372d..82c663c3 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,9 +1,11 @@ +const { jestPreset } = require('ts-jest') + module.exports = { collectCoverageFrom: ['src/**/*.{j,t}s'], coveragePathIgnorePatterns: ['/node_modules/', '.*\\.d\\.ts'], coverageThreshold: { global: { lines: 95 } }, transform: { - '^.*\\.ts$': 'ts-jest', + ...jestPreset.transform, '^.*\\.s?css$': '/test/_transformers/css.ts', }, testEnvironment: 'node', diff --git a/package.json b/package.json index a2ea9578..f9706034 100644 --- a/package.json +++ b/package.json @@ -42,12 +42,9 @@ "watch": "rollup -w -c" }, "devDependencies": { - "@babel/core": "^7.1.0", "@types/cheerio": "^0.22.9", "@types/jest": "^23.3.2", "autoprefixer": "^9.1.5", - "babel-core": "^7.0.0-0", - "babel-jest": "^23.6.0", "cheerio": "^1.0.0-rc.2", "codecov": "^3.1.0", "cssnano": "^4.1.0", @@ -57,9 +54,9 @@ "node-sass": "^4.9.3", "npm-run-all": "^4.1.3", "postcss-url": "^8.0.0", - "prettier": "^1.14.2", + "prettier": "^1.14.3", "rimraf": "^2.6.2", - "rollup": "^0.66.0", + "rollup": "^0.66.1", "rollup-plugin-commonjs": "^9.1.8", "rollup-plugin-json": "^3.1.0", "rollup-plugin-node-resolve": "^3.4.0", @@ -70,7 +67,7 @@ "stylelint-config-prettier": "^4.0.0", "stylelint-config-standard": "^18.2.0", "stylelint-scss": "^3.3.0", - "ts-jest": "^23.1.4", + "ts-jest": "23.10.0", "tslib": "^1.9.3", "tslint": "^5.11.0", "tslint-config-airbnb": "^5.11.0", @@ -78,7 +75,7 @@ "typescript": "^3.0.3" }, "dependencies": { - "@marp-team/marpit": "^0.1.1", + "@marp-team/marpit": "^0.1.2", "emoji-regex": "^7.0.1", "highlight.js": "^9.12.0", "katex": "^0.10.0-rc.1", diff --git a/test/fitting/observer.ts b/test/fitting/observer.ts index 357a6073..291c8fea 100644 --- a/test/fitting/observer.ts +++ b/test/fitting/observer.ts @@ -27,9 +27,13 @@ describe('Fitting observer', () => { beforeEach(() => { document.body.innerHTML = new Marp().render('# fitting').html - svg = document.querySelector('svg[data-marp-fitting="svg"]') - foreignObj = svg.querySelector('foreignObject') - content = foreignObj.querySelector('span[data-marp-fitting-svg-content]') + svg = document.querySelector( + 'svg[data-marp-fitting="svg"]' + )! + foreignObj = svg.querySelector('foreignObject')! + content = foreignObj.querySelector( + 'span[data-marp-fitting-svg-content]' + )! setContentSize(content, 100, 200) }) @@ -97,13 +101,20 @@ describe('Fitting observer', () => { '```\nauto-scalble\n```\n\n$$ auto-scalable $$' ).html - codeSvg = document.querySelector('svg[data-marp-fitting-code]') - codePre = document.querySelector('section pre') - codeContent = codeSvg.querySelector('span[data-marp-fitting-svg-content]') - - mathSvg = document.querySelector('svg[data-marp-fitting-math]') - mathP = mathSvg.parentElement as HTMLParagraphElement - mathContent = mathSvg.querySelector('span[data-marp-fitting-svg-content]') + codeSvg = document.querySelector( + 'svg[data-marp-fitting-code]' + )! + codePre = document.querySelector('section pre')! + codeContent = codeSvg.querySelector( + 'span[data-marp-fitting-svg-content]' + )! + mathSvg = document.querySelector( + 'svg[data-marp-fitting-math]' + )! + mathP = mathSvg.parentElement + mathContent = ( + mathSvg.querySelector('span[data-marp-fitting-svg-content]')! + ) setContentSize(codeContent, 200, 100) setContentSize(mathContent, 50, 100) diff --git a/test/marp.ts b/test/marp.ts index 78aa96d1..243d06b6 100644 --- a/test/marp.ts +++ b/test/marp.ts @@ -405,7 +405,8 @@ describe('Marp', () => { it('does not wrap by svg when specified theme has fittingCode meta as false', () => { const instance = marp() - instance.themeSet.get('uncover').meta.fittingCode = 'false' + const theme = instance.themeSet.get('uncover')! + theme.meta.fittingCode = 'false' const uncover = `---\ntheme: uncover\n---\n\n${markdown}` const $ = loadCheerio(instance.render(uncover).html) diff --git a/yarn.lock b/yarn.lock index 4096837b..d46d776c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8,7 +8,7 @@ dependencies: "@babel/highlight" "^7.0.0" -"@babel/core@^7.0.0-rc.1", "@babel/core@^7.1.0": +"@babel/core@^7.0.0-rc.1": version "7.1.0" resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.1.0.tgz#08958f1371179f62df6966d8a614003d11faeb04" dependencies: @@ -124,9 +124,9 @@ reflect-metadata "^0.1.12" tslib "^1.8.1" -"@marp-team/marpit@^0.1.1": - version "0.1.1" - resolved "https://registry.yarnpkg.com/@marp-team/marpit/-/marpit-0.1.1.tgz#82c2868eb3aca3eec32c3fcddcc412d760deef51" +"@marp-team/marpit@^0.1.2": + version "0.1.2" + resolved "https://registry.yarnpkg.com/@marp-team/marpit/-/marpit-0.1.2.tgz#1be638594519390233285f0bf67ebefa55f6fce4" dependencies: js-yaml "^3.12.0" lodash.kebabcase "^4.1.1" @@ -450,10 +450,6 @@ babel-core@^6.0.0, babel-core@^6.26.0: slash "^1.0.0" source-map "^0.5.7" -babel-core@^7.0.0-0: - version "7.0.0-bridge.0" - resolved "https://registry.yarnpkg.com/babel-core/-/babel-core-7.0.0-bridge.0.tgz#95a492ddd90f9b4e9a4a1da14eb335b87b634ece" - babel-generator@^6.18.0, babel-generator@^6.26.0: version "6.26.1" resolved "https://registry.yarnpkg.com/babel-generator/-/babel-generator-6.26.1.tgz#1844408d3b8f0d35a404ea7ac180f087a601bd90" @@ -670,13 +666,19 @@ browserslist@^4.0.0, browserslist@^4.1.0: electron-to-chromium "^1.3.62" node-releases "^1.0.0-alpha.11" +bs-logger@0.x: + version "0.2.5" + resolved "https://registry.yarnpkg.com/bs-logger/-/bs-logger-0.2.5.tgz#1d82f0cf88864e1341cd9262237f8d0748a49b22" + dependencies: + fast-json-stable-stringify "^2.0.0" + bser@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/bser/-/bser-2.0.0.tgz#9ac78d3ed5d915804fd87acb158bc797147a1719" dependencies: node-int64 "^0.4.0" -buffer-from@^1.0.0: +buffer-from@1.x, buffer-from@^1.0.0: version "1.1.1" resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef" @@ -876,10 +878,6 @@ clone@^1.0.2: version "1.0.4" resolved "https://registry.yarnpkg.com/clone/-/clone-1.0.4.tgz#da309cc263df15994c688ca902179ca3c7cd7c7e" -closest-file-data@^0.1.4: - version "0.1.4" - resolved "https://registry.yarnpkg.com/closest-file-data/-/closest-file-data-0.1.4.tgz#975f87c132f299d24a0375b9f63ca3fb88f72b3a" - co@^4.6.0: version "4.6.0" resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184" @@ -971,9 +969,15 @@ colors@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/colors/-/colors-1.1.2.tgz#168a4701756b6a7f51a12ce0c97bfa28c084ed63" -combined-stream@1.0.6, combined-stream@~1.0.5, combined-stream@~1.0.6: +combined-stream@1.0.6: version "1.0.6" - resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.6.tgz#723e7df6e801ac5613113a7e445a9b69cb632818" + resolved "http://registry.npmjs.org/combined-stream/-/combined-stream-1.0.6.tgz#723e7df6e801ac5613113a7e445a9b69cb632818" + dependencies: + delayed-stream "~1.0.0" + +combined-stream@~1.0.5, combined-stream@~1.0.6: + version "1.0.7" + resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.7.tgz#2d1d24317afb8abe95d6d2c0b07b57813539d828" dependencies: delayed-stream "~1.0.0" @@ -1489,8 +1493,8 @@ ecc-jsbn@~0.1.1: safer-buffer "^2.1.0" electron-to-chromium@^1.2.7, electron-to-chromium@^1.3.62: - version "1.3.68" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.68.tgz#bb3ccbadcdd06de2afea8fb73e31a60b6558de1f" + version "1.3.70" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.70.tgz#ded377256d92d81b4257d36c65aa890274afcfd2" emoji-regex@^7.0.1: version "7.0.1" @@ -1710,7 +1714,7 @@ fast-glob@^2.0.2: merge2 "^1.2.1" micromatch "^3.1.10" -fast-json-stable-stringify@^2.0.0: +fast-json-stable-stringify@2.x, fast-json-stable-stringify@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz#d5142c0caee6b1189f87d3a76111064f86c8bbf2" @@ -1827,14 +1831,6 @@ from@^0.1.7: version "0.1.7" resolved "https://registry.yarnpkg.com/from/-/from-0.1.7.tgz#83c60afc58b9c56997007ed1a768b3ab303a44fe" -fs-extra@6.0.1: - version "6.0.1" - resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-6.0.1.tgz#8abc128f7946e310135ddc93b98bddb410e7a34b" - dependencies: - graceful-fs "^4.1.2" - jsonfile "^4.0.0" - universalify "^0.1.0" - fs-extra@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-5.0.0.tgz#414d0110cdd06705734d055652c5411260c31abd" @@ -2312,7 +2308,7 @@ is-buffer@^1.1.4, is-buffer@^1.1.5: is-builtin-module@^1.0.0: version "1.0.0" - resolved "https://registry.yarnpkg.com/is-builtin-module/-/is-builtin-module-1.0.0.tgz#540572d34f7ac3119f8f76c30cbc1b1e037affbe" + resolved "http://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz#540572d34f7ac3119f8f76c30cbc1b1e037affbe" dependencies: builtin-modules "^1.0.0" @@ -3044,6 +3040,12 @@ json-stringify-safe@~5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" +json5@2.x: + version "2.0.1" + resolved "https://registry.yarnpkg.com/json5/-/json5-2.0.1.tgz#3d6d0d1066039eb50984e66a7840e4f4b7a2c660" + dependencies: + minimist "^1.2.0" + json5@^0.5.0, json5@^0.5.1: version "0.5.1" resolved "https://registry.yarnpkg.com/json5/-/json5-0.5.1.tgz#1eade7acc012034ad84e2396767ead9fa5495821" @@ -3237,10 +3239,14 @@ lru-cache@^4.0.1, lru-cache@^4.1.2: magic-string@^0.22.4: version "0.22.5" - resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.22.5.tgz#8e9cf5afddf44385c1da5bc2a6a0dbd10b03657e" + resolved "http://registry.npmjs.org/magic-string/-/magic-string-0.22.5.tgz#8e9cf5afddf44385c1da5bc2a6a0dbd10b03657e" dependencies: vlq "^0.2.2" +make-error@1.x: + version "1.3.5" + resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.5.tgz#efe4e81f6db28cadd605c70f29c831b58ef776c8" + makeerror@1.0.x: version "1.0.11" resolved "https://registry.yarnpkg.com/makeerror/-/makeerror-1.0.11.tgz#e01a5c9109f2af79660e4e8b9587790184f5a96c" @@ -3493,7 +3499,7 @@ mixin-deep@^1.2.0: for-in "^1.0.2" is-extendable "^1.0.1" -"mkdirp@>=0.5 0", mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.1: +mkdirp@0.x, "mkdirp@>=0.5 0", mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.1: version "0.5.1" resolved "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" dependencies: @@ -4624,9 +4630,9 @@ preserve@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b" -prettier@^1.13.0, prettier@^1.14.2: - version "1.14.2" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.14.2.tgz#0ac1c6e1a90baa22a62925f41963c841983282f9" +prettier@^1.13.0, prettier@^1.14.3: + version "1.14.3" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.14.3.tgz#90238dd4c0684b7edce5f83b0fb7328e48bd0895" pretty-format@^23.6.0: version "23.6.0" @@ -5094,15 +5100,15 @@ rollup-plugin-typescript@^1.0.0: rollup-pluginutils "^2.3.1" rollup-pluginutils@^2.0.1, rollup-pluginutils@^2.3.1: - version "2.3.2" - resolved "https://registry.yarnpkg.com/rollup-pluginutils/-/rollup-pluginutils-2.3.2.tgz#78d99a0a4baa281c80e23e5d911251ed5ab27d4f" + version "2.3.3" + resolved "https://registry.yarnpkg.com/rollup-pluginutils/-/rollup-pluginutils-2.3.3.tgz#3aad9b1eb3e7fe8262820818840bf091e5ae6794" dependencies: estree-walker "^0.5.2" - micromatch "^3.1.10" + micromatch "^2.3.11" -rollup@^0.66.0: - version "0.66.0" - resolved "https://registry.yarnpkg.com/rollup/-/rollup-0.66.0.tgz#697acc008f4b613695b17222c7626affddf4a506" +rollup@^0.66.1: + version "0.66.1" + resolved "https://registry.yarnpkg.com/rollup/-/rollup-0.66.1.tgz#4374a478a98ff075ee0e5bcafb9ab78ca968a301" dependencies: "@types/estree" "0.0.39" "@types/node" "*" @@ -5160,7 +5166,7 @@ scss-tokenizer@^0.2.3: js-base64 "^2.1.8" source-map "^0.4.2" -"semver@2 || 3 || 4 || 5", semver@^5.3.0, semver@^5.4.1, semver@^5.5.0: +"semver@2 || 3 || 4 || 5", semver@5.x, semver@^5.3.0, semver@^5.4.1, semver@^5.5.0: version "5.5.1" resolved "https://registry.yarnpkg.com/semver/-/semver-5.5.1.tgz#7dfdd8814bdb7cabc7be0fb1d734cfb66c940477" @@ -5796,14 +5802,18 @@ trough@^1.0.0: dependencies: glob "^7.1.2" -ts-jest@^23.1.4: - version "23.1.4" - resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-23.1.4.tgz#66ac1d8d3fbf8f9a98432b11aa377aa850664b2b" +ts-jest@23.10.0: + version "23.10.0" + resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-23.10.0.tgz#1b1ce1d795791dedf0229b7577b35eaed8565bbd" dependencies: - closest-file-data "^0.1.4" - fs-extra "6.0.1" - json5 "^0.5.0" - lodash "^4.17.10" + bs-logger "0.x" + buffer-from "1.x" + fast-json-stable-stringify "2.x" + json5 "2.x" + make-error "1.x" + mkdirp "0.x" + semver "5.x" + yargs-parser "10.x" tslib@1.9.0: version "1.9.0" @@ -6231,7 +6241,7 @@ yallist@^3.0.0, yallist@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.0.2.tgz#8452b4bb7e83c7c188d8041c1a837c773d6d8bb9" -yargs-parser@^10.0.0: +yargs-parser@10.x, yargs-parser@^10.0.0: version "10.1.0" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-10.1.0.tgz#7202265b89f7e9e9f2e5765e0fe735a905edbaa8" dependencies: