Sméagol-Gollum is a very complicated character at this time in his life. There is no doubt in my mind that Gollum always intended to sacrifice Frodo to Shelob, though exactly when he conceived of the plan is hard to determine.
However, the film's portrayal of his inner conflict isn't as exaggerated as it may appear; Frodo's treatment of him had begun to nurture the Sméagol side of his personality, and things may have gone differently if that side had won out.
My answer, then, is different depending on which personality you're talking about:
Gollum never intended to tell them because, as noted in answers by TheMathemagician and maguirenumber6, Gollum was intending to use Shelob to kill Frodo (something he couldn't do himself, because of his promise) so he could recover the Ring.
Revealing his evil plan would be a rather silly thing to do at this point.
Sméagol didn't really have a plan, but, if he was ever going to tell them, he would have done so not long before, on the Stairs:
Gollum looked at [Frodo and Sam]. A strange expression passed over his lean hungry face. The gleam faded from his eyes, and they went dim and grey, old and tired. A spasm of pain seemed to twist him, and he turned away, peering back up towards the pass, shaking his head, as if engaged in some interior debate. Then he came back, and slowly putting out a trembling hand, very cautiously he touched Frodo's knee - but almost the touch was a caress. For a fleeting moment, could one of the sleepers have seen him, they would have thought that they beheld an old weary hobbit, shrunken by the years that had carried him far beyond his time, beyond friends and kin, and the fields and streams of youth, an old starved pitiable thing.
But at that touch Frodo stirred and cried out softly in his sleep, and immediately Sam was wide awake. The first thing he saw was Gollum - 'pawing at master,' as he thought.
'Hey you!' he said roughly. 'What are you up to?'
'Nothing, nothing,' said Gollum softly. 'Nice Master!'
'I daresay,' said Sam. 'But where have you been to - sneaking off and sneaking back, you old villain?'
Gollum withdrew himself, and a green glint flickered under his heavy lids. Almost spider-like he looked now, crouched back on his bent limbs, with his protruding eyes. The fleeting moment had passed, beyond recall.
The Two Towers Book IV Chapter 8: "The Stairs of Cirith Ungol"
This last point bears expanding on.
Tolkien says in numerous letters that this moment was the closest Sméagol-Gollum came to repentance; a selection include:
I was prob. most moved by Sam's disquisition on the seamless web of story, and by the scene when Frodo goes to sleep on his breast, and the tragedy of Gollum who at that moment came within a hair of repentance – but for one rough word from Sam.
The Letters of J.R.R. Tolkien 96: To Christopher Tolkien. January 1945
I am most stirred by the sound of the horses of the Rohirrim at cockcrow; and most grieved by Gollum's failure (just) to repent when interrupted by Sam
The Letters of J.R.R. Tolkien 165: To the Houghton Mifflin Co. June 1955
By temporizing, not fixing the still not wholly corrupt Smeagol-will towards good in the debate in the slag hole, he weakened himself for the final chance when dawning love of Frodo was too easily withered by the jealousy of Sam before Shelob's lair. After that he was lost.
The Letters of J.R.R. Tolkien 181: To Michael Straight (draft). February 1956
If [Sam] had understood better what was going on between Frodo and Gollum, things might have turned out differently in the end. For me perhaps the most tragic moment in the Tale comes in II 323 ff. when Sam fails to note the complete change in Gollum's tone and aspect. 'Nothing, nothing', said Gollum softly. 'Nice master!'. His repentance is blighted and all Frodo's pity is (in a sense) wasted. Shelob's lair became inevitable.
The Letters of J.R.R. Tolkien 246: To Mrs. Eileen Elgar (Draft). September 1963
The last one I find especially interesting; "Shelob's lair became inevitable" suggests to me that, had he repented at this moment, he could have avoided their confrontation with Shelob; Tolkien implies this more directly later in Letter 246 (emphasis mine):
Sam could hardly have acted differently. (He did reach the point of pity at last (III 221-222) but for the good of Gollum too late.) If he had, what could then have happened? The course of the entry into Mordor and the struggle to reach Mount Doom would have been different, and so would the ending.
The Letters of J.R.R. Tolkien 246: To Mrs. Eileen Elgar (Draft). September 1963
Whether Sméagol would have told the hobbits, "Oh, by the way, watch out for the hungry spider-monster," or whether he would have kept silent and just taken a different route through the tunnels, or if he would have found or remembered another way over the Ephel Dúath, is unknown.
However, the ultimate answer for the Sméagol personality is that he just wasn't strong enough yet; Tolkien remarks in letter 181 quoted above) about Sméagol's "temporizing [...] in the debate in the slag-hole"; the moment he references is this one (emphasis mine)1:
Most Precious Gollum! Must have it. We wants it, we wants it, we wants it!'
'But there's two of them. They'll wake too quick and kill us,' whined Sméagol in a last effort. 'Not now. Not yet.'
The Two Towers Book IV Chapter 2: "The Passage of the Marshes"
The fact that Sméagol loses this debate, despite clearly not wanting to kill Frodo, is proof enough that he isn't the dominant side of the personality; Gollum still has too much control, and (as Tolkien suggests in letter 181), Sméagol weakens his own resolve here by giving in.
1 This is earlier in the same conversation referenced in Daniel Roseman's answer