diff --git a/lua/tests/minimal_init.lua b/lua/tests/minimal_init.lua index 44cdffa..6f4b692 100644 --- a/lua/tests/minimal_init.lua +++ b/lua/tests/minimal_init.lua @@ -8,5 +8,6 @@ end vim.cmd [[ set rtp+=. set rtp+=../plenary.nvim + set rtp+=../nvim-web-devicons/ runtime plugin/plenary.vim ]] diff --git a/lua/tests/spec/component_spec.lua b/lua/tests/spec/component_spec.lua index 1697ae9..f9bdbf4 100644 --- a/lua/tests/spec/component_spec.lua +++ b/lua/tests/spec/component_spec.lua @@ -258,11 +258,19 @@ describe('Filetype component', function() end) it('does not add icon when library unavailable', function() + local old_require = _G.require + function _G.require(...) + if select(1, ...) == 'nvim-web-devicons' then + error("Test case not suppose to have web-dev-icon 👀") + end + return old_require(...) + end local opts = build_component_opts { component_separators = { left = '', right = '' }, padding = 0, } assert_component('filetype', opts, 'lua') + _G.require = old_require end) it('colors nvim-web-devicons icons', function()