Skip to content

Commit

Permalink
Merge pull request #25 from marp-team/upgrade-dependencies
Browse files Browse the repository at this point in the history
Upgrade dependent packages to latest
  • Loading branch information
yhatt committed Sep 20, 2018
2 parents 9a31b44 + 3984c28 commit bc24324
Show file tree
Hide file tree
Showing 8 changed files with 204 additions and 229 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@

### Changed

- Upgrade [Marpit v0.1.1](https://github.com/marp-team/marpit/releases/tag/v0.1.1) and [marp-team/marp-core v0.0.8](https://github.com/marp-team/marp-core/releases/tag/v0.0.8) ([#21](https://github.com/marp-team/marp-cli/pull/21))
- Upgrade [Marpit v0.1.2](https://github.com/marp-team/marpit/releases/tag/v0.1.2) and [marp-team/marp-core v0.0.9](https://github.com/marp-team/marp-core/releases/tag/v0.0.9) ([#25](https://github.com/marp-team/marp-cli/pull/25))
- Upgrade dependent packages to latest version with many update of settings ([#25](https://github.com/marp-team/marp-cli/pull/25))

## v0.0.9 - 2018-09-18

Expand Down
7 changes: 4 additions & 3 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
const { jestPreset } = require('ts-jest')

module.exports = {
collectCoverageFrom: ['src/**/*.ts'],
coveragePathIgnorePatterns: ['/node_modules/', '.*\\.d\\.ts'],
coverageThreshold: { global: { lines: 95 } },
moduleFileExtensions: ['ts', 'js', 'json', 'node'],
setupFiles: ['jest-plugin-context/setup'],
transform: {
'^.*\\.ts$': 'ts-jest',
transform: Object.assign({}, jestPreset.transform, {
'^.*\\.s?css$': '<rootDir>/test/_transformers/css.js',
'^.*\\.pug$': '<rootDir>/test/_transformers/pug.js',
},
}),
testEnvironment: 'node',
testRegex: '(/(test|__tests__)/(?!_).*|(\\.|/)(test|spec))\\.[jt]s$',
}
26 changes: 13 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,16 @@
"watch": "rollup -w -c"
},
"devDependencies": {
"@babel/core": "^7.0.1",
"@types/chokidar": "^1.7.5",
"@types/cosmiconfig": "^5.0.3",
"@types/get-stdin": "^5.0.1",
"@types/jest": "^23.3.2",
"@types/jest-plugin-context": "^2.9.0",
"@types/node": "^10.9.4",
"@types/node": "^10.10.1",
"@types/pug": "^2.0.4",
"@types/puppeteer": "^1.6.4",
"@types/ws": "^6.0.1",
"@types/yargs": "^11.1.1",
"@types/yargs": "^12.0.0",
"autoprefixer": "^9.1.5",
"bespoke": "^1.1.0",
"bespoke-keys": "^1.1.0",
Expand All @@ -65,35 +64,36 @@
"jest-plugin-context": "^2.9.0",
"node-sass": "^4.9.3",
"npm-run-all": "^4.1.3",
"prettier": "^1.14.2",
"prettier": "^1.14.3",
"pug": "^2.0.3",
"rimraf": "^2.6.2",
"rollup": "^0.65.2",
"rollup-plugin-commonjs": "^9.1.6",
"rollup": "^0.66.1",
"rollup-plugin-commonjs": "^9.1.8",
"rollup-plugin-json": "^3.1.0",
"rollup-plugin-node-resolve": "^3.4.0",
"rollup-plugin-postcss": "^1.6.2",
"rollup-plugin-pug": "^0.1.6",
"rollup-plugin-terser": "^2.0.2",
"rollup-plugin-typescript": "^0.8.1",
"rollup-plugin-pug": "^1.0.0",
"rollup-plugin-terser": "^3.0.0",
"rollup-plugin-typescript": "^1.0.0",
"strip-ansi": "^4.0.0",
"stylelint": "^9.5.0",
"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",
"ts-keycode-enum": "^1.0.6",
"tslib": "^1.9.3",
"tslint": "^5.11.0",
"tslint-config-airbnb": "^5.11.0",
"tslint-config-prettier": "^1.15.0",
"typescript": "^3.0.3"
},
"dependencies": {
"@marp-team/marp-core": "^0.0.8",
"@marp-team/marpit": "^0.1.1",
"@marp-team/marp-core": "^0.0.9",
"@marp-team/marpit": "^0.1.2",
"chalk": "^2.4.1",
"chokidar": "^2.0.4",
"chrome-launcher": "^0.10.2",
"chrome-launcher": "^0.10.4",
"cosmiconfig": "^5.0.6",
"get-stdin": "^6.0.0",
"globby": "^8.0.1",
Expand Down
10 changes: 3 additions & 7 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ import nodeResolve from 'rollup-plugin-node-resolve'
import postcss from 'rollup-plugin-postcss'
import pugPlugin from 'rollup-plugin-pug'
import { terser } from 'rollup-plugin-terser'
import typescriptPlugin from 'rollup-plugin-typescript'
import typescript from 'typescript'
import typescript from 'rollup-plugin-typescript'
import { dependencies } from './package.json'

const external = [
Expand All @@ -23,15 +22,12 @@ const plugins = [
json({ preferConst: true }),
nodeResolve({ jsnext: true }),
commonjs(),
typescriptPlugin({
resolveJsonModule: false, // JSON has already resolved by rollup-plugin-json
typescript,
}),
typescript({ resolveJsonModule: false }),
postcss({
inject: false,
plugins: [autoprefixer(), cssnano({ preset: 'default' })],
}),
pugPlugin(),
pugPlugin({ pugRuntime: 'pug-runtime' }),
!process.env.ROLLUP_WATCH && terser(),
]

Expand Down
9 changes: 4 additions & 5 deletions test/marp-cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@ import { Watcher } from '../src/watcher'
const { version } = require('../package.json')
const coreVersion = require('@marp-team/marp-core/package.json').version

jest
.mock('fs')
.mock('mkdirp')
.mock('../src/watcher', () => jest.genMockFromModule('../src/watcher'))
jest.mock('fs')
jest.mock('mkdirp')
jest.mock('../src/watcher', () => jest.genMockFromModule('../src/watcher'))

afterEach(() => jest.restoreAllMocks())

Expand Down Expand Up @@ -203,7 +202,7 @@ describe('Marp CLI', () => {

const converter = <Converter>convert.mock.instances[0]
const { themeSet } = converter.options
const theme = themeSet.themes.get(cssFile)
const theme = themeSet.themes.get(cssFile)!

expect(theme.overridenName).not.toBeUndefined()
expect(converter.options.theme).toBe(theme.overridenName)
Expand Down
2 changes: 1 addition & 1 deletion test/templates/bespoke.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe("Bespoke template's browser context", () => {

const render = (md = defaultMarkdown): HTMLElement => {
document.body.innerHTML = marp.render(md).html
return document.getElementById('presentation')
return document.getElementById('presentation')!
}

describe('Classes', () => {
Expand Down
49 changes: 24 additions & 25 deletions test/watcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,21 @@ import { Watcher, WatchNotifier, notifier } from '../src/watcher'

const mockWsOn = jest.fn()

jest
.mock('chokidar', () => ({
watch: jest.fn(() => ({
on: jest.fn(function() {
return this
}),
})),
}))
.mock('ws', () => ({
Server: jest.fn(() => ({
close: jest.fn(),
on: mockWsOn,
})),
}))
.mock('../src/watcher')
.mock('../src/theme')
jest.mock('chokidar', () => ({
watch: jest.fn(() => ({
on: jest.fn(function(this: any) {
return this
}),
})),
}))
jest.mock('ws', () => ({
Server: jest.fn(() => ({
close: jest.fn(),
on: mockWsOn,
})),
}))
jest.mock('../src/watcher')
jest.mock('../src/theme')

afterEach(() => {
jest.restoreAllMocks()
Expand Down Expand Up @@ -75,9 +74,9 @@ describe('Watcher', () => {
expect(on).toHaveBeenCalledWith('add', expect.any(Function))
expect(on).toHaveBeenCalledWith('unlink', expect.any(Function))

const onChange = on.mock.calls.find(([e]) => e === 'change')[1]
const onAdd = on.mock.calls.find(([e]) => e === 'add')[1]
const onUnlink = on.mock.calls.find(([e]) => e === 'unlink')[1]
const onChange = on.mock.calls.find(([e]) => e === 'change')![1]
const onAdd = on.mock.calls.find(([e]) => e === 'add')![1]
const onUnlink = on.mock.calls.find(([e]) => e === 'unlink')![1]

// Callbacks
const conv = jest.spyOn(<any>watcher, 'convert').mockImplementation()
Expand Down Expand Up @@ -187,12 +186,12 @@ describe('WatchNotifier', () => {

const listenerSet = instance.listeners.get(testIdentifier)
expect(listenerSet).toBeInstanceOf(Set)
expect(listenerSet.size).toBe(0)
expect(listenerSet!.size).toBe(0)

// Keep the content of set even if called twice
listenerSet.add('test')
listenerSet!.add('test')
await instance.register('test')
expect(listenerSet.size).toBe(1)
expect(listenerSet!.size).toBe(1)
})
})

Expand Down Expand Up @@ -257,20 +256,20 @@ describe('WatchNotifier', () => {

expect(mockWsOn).toBeCalledTimes(1)
expect(mockWsOn).toBeCalledWith('connection', expect.any(Function))
expect(instance.listeners.get(testIdentifier).size).toBe(0)
expect(instance.listeners.get(testIdentifier)!.size).toBe(0)

const [, connection] = mockWsOn.mock.calls[0]
connection(ws, { url: `/${testIdentifier}` })
expect(ws.send).toHaveBeenCalledWith('ready')
expect(instance.listeners.get(testIdentifier).has(ws)).toBe(true)
expect(instance.listeners.get(testIdentifier)!.has(ws)).toBe(true)

// Remove listener by closing connection
expect(ws.on).toHaveBeenCalledTimes(1)
expect(ws.on).toHaveBeenCalledWith('close', expect.any(Function))

const [, onclose] = ws.on.mock.calls[0]
onclose()
expect(instance.listeners.get(testIdentifier).has(ws)).toBe(false)
expect(instance.listeners.get(testIdentifier)!.has(ws)).toBe(false)
})

it('closes client socket immediately when passed invalid URL', async () => {
Expand Down
Loading

0 comments on commit bc24324

Please sign in to comment.