fix: app.getAppPath() returning default-app path for files or directories without package.json (#18763)
This commit is contained in:
parent
7201845894
commit
79f0c444fd
4 changed files with 40 additions and 2 deletions
|
@ -645,6 +645,28 @@ describe('app module', () => {
|
|||
})
|
||||
})
|
||||
|
||||
describe('getAppPath', () => {
|
||||
it('works for directories with package.json', async () => {
|
||||
const { appPath } = await runTestApp('app-path')
|
||||
expect(appPath).to.equal(path.resolve(fixturesPath, 'api/app-path'))
|
||||
})
|
||||
|
||||
it('works for directories with index.js', async () => {
|
||||
const { appPath } = await runTestApp('app-path/lib')
|
||||
expect(appPath).to.equal(path.resolve(fixturesPath, 'api/app-path/lib'))
|
||||
})
|
||||
|
||||
it('works for files without extension', async () => {
|
||||
const { appPath } = await runTestApp('app-path/lib/index')
|
||||
expect(appPath).to.equal(path.resolve(fixturesPath, 'api/app-path/lib'))
|
||||
})
|
||||
|
||||
it('works for files', async () => {
|
||||
const { appPath } = await runTestApp('app-path/lib/index.js')
|
||||
expect(appPath).to.equal(path.resolve(fixturesPath, 'api/app-path/lib'))
|
||||
})
|
||||
})
|
||||
|
||||
describe('getPath(name)', () => {
|
||||
it('returns paths that exist', () => {
|
||||
const paths = [
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue