Wrap temp.cleanupSync() calls in try-catch blocks

This commit is contained in:
Ash Wilson
2017-08-04 14:18:43 -04:00
parent 97ffe46247
commit dc9fe25255
17 changed files with 56 additions and 17 deletions

View File

@@ -6,7 +6,8 @@ StorageFolder = require '../src/storage-folder'
describe "AtomEnvironment", ->
afterEach ->
temp.cleanupSync()
try
temp.cleanupSync()
describe 'window sizing methods', ->
describe '::getPosition and ::setPosition', ->

View File

@@ -86,7 +86,11 @@ describe("AtomPaths", () => {
afterEach(() => {
delete process.env.ATOM_HOME
fs.removeSync(electronUserDataPath)
temp.cleanupSync()
try {
temp.cleanupSync()
} catch (e) {
// Ignore
}
app.setPath('userData', defaultElectronUserDataPath)
})

View File

@@ -19,7 +19,8 @@ describe "Babel transpiler support", ->
afterEach ->
CompileCache.setCacheDirectory(originalCacheDir)
temp.cleanupSync()
try
temp.cleanupSync()
describe 'when a .js file starts with /** @babel */;', ->
it "transpiles it using babel", ->

View File

@@ -21,7 +21,8 @@ describe "CommandInstaller on #darwin", ->
spyOn(CommandInstaller::, 'getInstallDirectory').andReturn(installationPath)
afterEach ->
temp.cleanupSync()
try
temp.cleanupSync()
it "shows an error dialog when installing commands interactively fails", ->
appDelegate = jasmine.createSpyObj("appDelegate", ["confirm"])

View File

@@ -23,7 +23,8 @@ describe 'CompileCache', ->
afterEach ->
CompileCache.setAtomHomeDirectory(process.env.ATOM_HOME)
CSON.setCacheDir(CompileCache.getCacheDirectory())
temp.cleanupSync()
try
temp.cleanupSync()
describe 'addPathToCache(filePath, atomHome)', ->
describe 'when the given file is plain javascript', ->

View File

@@ -10,7 +10,8 @@ describe "DefaultDirectoryProvider", ->
tmp = temp.mkdirSync('atom-spec-default-dir-provider')
afterEach ->
temp.cleanupSync()
try
temp.cleanupSync()
describe ".directoryForURISync(uri)", ->
it "returns a Directory with a path that matches the uri", ->

View File

@@ -12,7 +12,8 @@ describe "GitRepositoryProvider", ->
provider = new GitRepositoryProvider(atom.project, atom.config, atom.confirm)
afterEach ->
temp.cleanupSync()
try
temp.cleanupSync()
describe ".repositoryForDirectory(directory)", ->
describe "when specified a Directory with a Git repository", ->

View File

@@ -24,7 +24,8 @@ describe "the `grammars` global", ->
afterEach ->
atom.packages.deactivatePackages()
atom.packages.unloadPackages()
temp.cleanupSync()
try
temp.cleanupSync()
describe ".selectGrammar(filePath)", ->
it "always returns a grammar", ->

View File

@@ -16,7 +16,11 @@ describe("FileRecoveryService", () => {
})
afterEach(() => {
temp.cleanupSync()
try {
temp.cleanupSync()
} catch (e) {
// Ignore
}
})
describe("when no crash happens during a save", () => {

View File

@@ -9,7 +9,8 @@ describe 'ModuleCache', ->
spyOn(Module, '_findPath').andCallThrough()
afterEach ->
temp.cleanupSync()
try
temp.cleanupSync()
it 'resolves Electron module paths without hitting the filesystem', ->
builtins = ModuleCache.cache.builtins

View File

@@ -17,7 +17,8 @@ describe "PackageManager", ->
spyOn(ModuleCache, 'add')
afterEach ->
temp.cleanupSync()
try
temp.cleanupSync()
describe "::getApmPath()", ->
it "returns the path to the apm command", ->

View File

@@ -37,7 +37,8 @@ describe "Windows Squirrel Update", ->
WinShell.folderBackgroundContextMenu = new FakeShellOption()
afterEach ->
temp.cleanupSync()
try
temp.cleanupSync()
it "quits the app on all squirrel events", ->
app = quit: jasmine.createSpy('quit')

View File

@@ -15,7 +15,11 @@ describe('StyleManager', () => {
})
afterEach(() => {
temp.cleanupSync()
try {
temp.cleanupSync()
} catch (e) {
// Do nothing
}
})
describe('::addStyleSheet(source, params)', () => {

View File

@@ -9,7 +9,8 @@ describe "atom.themes", ->
afterEach ->
atom.themes.deactivateThemes()
temp.cleanupSync()
try
temp.cleanupSync()
describe "theme getters and setters", ->
beforeEach ->

View File

@@ -28,7 +28,11 @@ describe('updateProcessEnv(launchEnv)', function () {
}
process.env = originalProcessEnv
process.platform = originalProcessPlatform
temp.cleanupSync()
try {
temp.cleanupSync()
} catch (e) {
// Do nothing
}
})
describe('when the launch environment appears to come from a shell', function () {

View File

@@ -9,7 +9,13 @@ const {Disposable} = require('event-kit')
const {it, fit, ffit, fffit, beforeEach, afterEach} = require('./async-spec-helpers')
describe('WorkspaceElement', () => {
afterEach(() => { temp.cleanupSync() })
afterEach(() => {
try {
temp.cleanupSync()
} catch (e) {
// Do nothing
}
})
describe('when the workspace element is focused', () => {
it('transfers focus to the active pane', () => {

View File

@@ -25,7 +25,13 @@ describe('Workspace', () => {
waitsForPromise(() => atom.workspace.itemLocationStore.clear())
})
afterEach(() => temp.cleanupSync())
afterEach(() => {
try {
temp.cleanupSync()
} catch (e) {
// Do nothing
}
})
function simulateReload() {
waitsForPromise(() => {