mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-31 07:40:33 +00:00
refactor: change _open endpoint to /__open-in-editor
upgrade @nuxtjs/youch to 4.0.0 ref: vuejs/vue-devtools#483
This commit is contained in:
parent
5b923fd97e
commit
96c3b4a15b
@ -226,7 +226,7 @@ module.exports = class Renderer {
|
|||||||
const _this = this
|
const _this = this
|
||||||
if (this.options.debug && this.options.dev) {
|
if (this.options.debug && this.options.dev) {
|
||||||
this.useMiddleware({
|
this.useMiddleware({
|
||||||
path: '_open',
|
path: '__open-in-editor',
|
||||||
handler(req, res) {
|
handler(req, res) {
|
||||||
// Lazy load open-in-editor
|
// Lazy load open-in-editor
|
||||||
const openInEditor = require('open-in-editor')
|
const openInEditor = require('open-in-editor')
|
||||||
|
@ -56,7 +56,7 @@
|
|||||||
"npm": ">=5.0.0"
|
"npm": ">=5.0.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@nuxtjs/youch": "^3.1.0",
|
"@nuxtjs/youch": "^4.0.0",
|
||||||
"ansi-html": "^0.0.7",
|
"ansi-html": "^0.0.7",
|
||||||
"autoprefixer": "^7.2.3",
|
"autoprefixer": "^7.2.3",
|
||||||
"babel-core": "^6.26.0",
|
"babel-core": "^6.26.0",
|
||||||
|
@ -25,18 +25,18 @@ test.serial('Init Nuxt.js', async t => {
|
|||||||
t.true(logSpy.calledWithMatch('OPEN'))
|
t.true(logSpy.calledWithMatch('OPEN'))
|
||||||
})
|
})
|
||||||
|
|
||||||
test.serial('/test/_open (open-in-editor)', async t => {
|
test.serial('/test/__open-in-editor (open-in-editor)', async t => {
|
||||||
const logSpy = await interceptLog()
|
const logSpy = await interceptLog()
|
||||||
const { body } = await rp(url('/test/_open?file=pages/index.vue'), { resolveWithFullResponse: true })
|
const { body } = await rp(url('/test/__open-in-editor?file=pages/index.vue'), { resolveWithFullResponse: true })
|
||||||
t.is(body, 'opened in editor!')
|
t.is(body, 'opened in editor!')
|
||||||
release()
|
release()
|
||||||
t.is(logSpy.getCall(0).args[0], '[open in editor]')
|
t.is(logSpy.getCall(0).args[0], '[open in editor]')
|
||||||
t.true(logSpy.calledOnce)
|
t.true(logSpy.calledOnce)
|
||||||
})
|
})
|
||||||
|
|
||||||
test.serial('/test/_open should return error (open-in-editor)', async t => {
|
test.serial('/test/__open-in-editor should return error (open-in-editor)', async t => {
|
||||||
const logSpy = await interceptLog()
|
const logSpy = await interceptLog()
|
||||||
const { body } = await rp(url('/test/_open?file='), { resolveWithFullResponse: true })
|
const { body } = await rp(url('/test/__open-in-editor?file='), { resolveWithFullResponse: true })
|
||||||
t.is(body, 'File is not specified')
|
t.is(body, 'File is not specified')
|
||||||
release()
|
release()
|
||||||
t.is(logSpy.getCall(0).args[0], '[open in editor]')
|
t.is(logSpy.getCall(0).args[0], '[open in editor]')
|
||||||
|
2
test/fixtures/debug/nuxt.config.js
vendored
2
test/fixtures/debug/nuxt.config.js
vendored
@ -2,7 +2,7 @@ module.exports = {
|
|||||||
router: {
|
router: {
|
||||||
base: '/test/'
|
base: '/test/'
|
||||||
},
|
},
|
||||||
dev: true, // Needed for _open middleware
|
dev: true, // Needed for __open-in-editor middleware
|
||||||
debug: true,
|
debug: true,
|
||||||
editor: {
|
editor: {
|
||||||
cmd: 'echo',
|
cmd: 'echo',
|
||||||
|
@ -97,9 +97,9 @@
|
|||||||
dependencies:
|
dependencies:
|
||||||
arrify "^1.0.1"
|
arrify "^1.0.1"
|
||||||
|
|
||||||
"@nuxtjs/youch@^3.1.0":
|
"@nuxtjs/youch@^4.0.0":
|
||||||
version "3.1.0"
|
version "4.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/@nuxtjs/youch/-/youch-3.1.0.tgz#0e4f38d1b9ede2a77b121c02cbd839937e8918ad"
|
resolved "https://registry.yarnpkg.com/@nuxtjs/youch/-/youch-4.0.0.tgz#74eb880f57a3f76f7684f69ba2753a815f308deb"
|
||||||
dependencies:
|
dependencies:
|
||||||
cookie "^0.3.1"
|
cookie "^0.3.1"
|
||||||
mustache "^2.3.0"
|
mustache "^2.3.0"
|
||||||
|
Loading…
Reference in New Issue
Block a user