lune: require(script.Parent.) fails because script is nil #21
Copy link
Copy link
Open
Description
Activity
I'm probably doing this wrong, and it's not even supposed to work; but run-in-roblox fails on linux (due to the roblox-install crate not yet supporting vinegar or vinegar flatpak) so I thought I'd try running jest in lune.
(Copilot) hacked at this for a minute, so it has the pcall and the comment about Packages.Project (which is necessary due to Rojo/wally iiuc?)
local ReplicatedStorage = nil local runCLI = nil local isLune = (_VERSION:gmatch("Lune")() == "Lune") if isLune then -- local roblox = nil -- local ok, mod = pcall(require, "@lune/roblox") -- if ok then -- roblox = mod -- else -- print("ERROR: require('@lune/roblox') failed") -- end local roblox = require("@lune/roblox") local Instance = roblox.Instance local game = Instance.new("DataModel") local _workspace = game:GetService("Workspace") print("DEBUG: @lune/roblox: game=Instance.new('DataModel') => " .. tostring(game) .. " type=" .. typeof(game)) assert(game ~= nil) -- Create ReplicatedStorage, DevPackages, and Packages folders -- ReplicatedStorage = Instance.new("Folder") -- ReplicatedStorage.Name = "ReplicatedStorage" ReplicatedStorage = Instance.new("ReplicatedStorage") --game.ReplicatedStorage = ReplicatedStorage local DevPackages = Instance.new("Folder") DevPackages.Name = "DevPackages" DevPackages.Parent = ReplicatedStorage local Packages = Instance.new("Folder") Packages.Name = "Packages" Packages.Parent = ReplicatedStorage -- Insert Jest as a ModuleScript-like table --local jestModule = require("./stemgame/DevPackages/_Index/jsdotlua_jest@3.10.0/jest/src/init.lua") local jestModule = require("./DevPackages/Jest") DevPackages.Jest = jestModule -- TODO: this is going to fail -- Is there a way to rojo_require("./default.project.json") here -- Or is it better or only possible to create the .rblxm with rojo and then deserializePlace(place.rblx) -- You may need to insert your Project module into Packages.Project here if your tests require it -- Example: Packages.Project = require("path/to/your/project/init.lua") runCLI = DevPackages.Jest.runCLI else ReplicatedStorage = game:GetService("ReplicatedStorage") runCLI = require(ReplicatedStorage.DevPackages.Jest).runCLI end local processServiceExists, ProcessService = pcall(function() return game:GetService("ProcessService") end) local status, result = runCLI(ReplicatedStorage.Packages.Project, { verbose = true, ci = false }, { ReplicatedStorage.Packages.Project }):awaitStatus() if status == "Rejected" then print(result) end if status == "Resolved" and result.results.numFailedTestSuites == 0 and result.results.numFailedTests == 0 then if processServiceExists then ProcessService:ExitAsync(0) end end if processServiceExists then ProcessService:ExitAsync(1) end return nil
(Perhaps pesde would be easier for this. Though FWIU pesde supports installing wally packages (and git repos) but not rojo sync?)
- From roblox/jest-roblox: Roblox@72aa2d9#diff-06572a96a58dc510037d5efa622f9bec8519bc1beab13c9f251e97e657a9d4edR5-R6 ::
- 🛠️ Rojo + Luau LSP is the new default workflow for Jest development (#453)
- jest.default.json -> default.project.json (the Rojo default)
- From roblox/jest-roblox: Roblox@72aa2d9#diff-06572a96a58dc510037d5efa622f9bec8519bc1beab13c9f251e97e657a9d4edR5-R6 ::
Metadata
Metadata
Assignees
Labels
No labels
Trying to run jest-lua in lune (with wally and rojo)
./DevPackages/_Index/...and./Packages/_Index/..., and creates aliases to require instead:For example:
But
require(script.Parent)fails with:Could or should lune set
scriptso thatscript.Parentworks?